:root {
  color-scheme: light;
  --editor-ink: #0b1b45;
  --editor-muted: #5f6879;
  --editor-line: #d8deea;
  --editor-panel: #ffffff;
  --editor-bg: #f3f5f8;
  --editor-accent: #ffdc18;
  --editor-danger: #b42318;
  --editor-success: #067647;
  --editor-focus: #1b62d1;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--editor-bg); }
body {
  margin: 0;
  color: var(--editor-ink);
  background: var(--editor-bg);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 3px solid rgba(27, 98, 209, .3); outline-offset: 2px; }

.editor-shell { min-height: 100vh; }
.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 88px;
  padding: 14px clamp(18px, 5vw, 72px);
  border-top: 4px solid #202027;
  border-bottom: 1px solid var(--editor-line);
  background: #fff;
}
.editor-brand { display: flex; align-items: center; gap: 16px; color: inherit; text-decoration: none; }
.editor-brand img { width: 106px; height: 58px; object-fit: contain; }
.editor-brand strong, .editor-brand span { display: block; letter-spacing: 0; }
.editor-brand span { color: var(--editor-muted); font-size: .84rem; }
.editor-back { color: var(--editor-ink); font-weight: 700; text-decoration: none; }

.editor-main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 64px; }
.editor-login {
  width: min(460px, 100%);
  margin: 7vh auto 0;
  padding: 32px;
  border: 1px solid var(--editor-line);
  border-radius: 8px;
  background: var(--editor-panel);
  box-shadow: 0 18px 45px rgba(11, 27, 69, .1);
}
.editor-login h1, .editor-heading h2 { margin: 0 0 8px; font-size: clamp(1.7rem, 3vw, 2.35rem); line-height: 1.15; }
.editor-login > p, .editor-heading p { margin: 0; color: var(--editor-muted); }
.editor-form { display: grid; gap: 18px; margin-top: 28px; }
.editor-field { display: grid; gap: 7px; }
.editor-field label { font-size: .9rem; font-weight: 700; }
.editor-input, .editor-search, .editor-row-input, .editor-bulk textarea {
  width: 100%;
  min-height: 50px;
  padding: 11px 14px;
  color: var(--editor-ink);
  border: 1px solid #aeb7c8;
  border-radius: 6px;
  background: #fff;
}
.editor-input:focus, .editor-search:focus, .editor-row-input:focus, .editor-bulk textarea:focus { border-color: var(--editor-focus); }
.editor-password { position: relative; }
.editor-password .editor-input { padding-right: 78px; }
.editor-password-toggle {
  position: absolute;
  top: 7px;
  right: 7px;
  min-height: 36px;
  padding: 4px 9px;
  border: 0;
  color: var(--editor-ink);
  background: transparent;
  font-size: .82rem;
  font-weight: 700;
}
.editor-btn {
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
}
.editor-btn-primary { color: #101629; background: var(--editor-accent); }
.editor-btn-secondary { color: var(--editor-ink); border-color: #9ca7ba; background: #fff; }
.editor-btn-danger { color: var(--editor-danger); border-color: #f3b8b2; background: #fff; }
.editor-message { min-height: 24px; margin: 0; color: var(--editor-danger); font-size: .9rem; }
.editor-message.is-success { color: var(--editor-success); }
[hidden] { display: none !important; }

.editor-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.editor-heading-actions { display: flex; align-items: center; gap: 10px; }
.editor-unsaved { padding: 5px 9px; color: #7a2e0e; background: #fff1d6; border-radius: 4px; font-size: .8rem; font-weight: 700; }
.editor-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.editor-stat { padding: 15px 18px; border: 1px solid var(--editor-line); border-radius: 6px; background: #fff; }
.editor-stat strong { display: block; font-size: 1.4rem; }
.editor-stat span { color: var(--editor-muted); font-size: .82rem; }
.editor-stat.is-error strong { color: var(--editor-danger); }

.editor-tools {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto auto;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--editor-line);
  border-radius: 8px 8px 0 0;
  background: #fff;
}
.editor-add { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 10px; padding: 16px; border: 1px solid var(--editor-line); border-top: 0; background: #fff; }
.editor-bulk { padding: 16px; border: 1px solid var(--editor-line); border-top: 0; background: #fbfcfe; }
.editor-bulk textarea { min-height: 140px; resize: vertical; }
.editor-bulk-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

.editor-list-wrap { border: 1px solid var(--editor-line); border-top: 0; background: #fff; }
.editor-list-head, .editor-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 48px; gap: 12px; align-items: center; }
.editor-list-head { min-height: 42px; padding: 6px 14px; color: var(--editor-muted); background: #edf1f6; font-size: .78rem; font-weight: 700; text-transform: uppercase; }
.editor-list { margin: 0; padding: 0; list-style: none; }
.editor-row { min-height: 62px; padding: 6px 14px; border-top: 1px solid #e7eaf0; }
.editor-row-number { color: var(--editor-muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.editor-row-input { min-height: 44px; }
.editor-row.is-invalid { background: #fff4f2; }
.editor-row.is-invalid .editor-row-input { border-color: var(--editor-danger); }
.editor-icon-btn { width: 40px; height: 40px; padding: 0; border: 1px solid transparent; border-radius: 4px; color: var(--editor-danger); background: transparent; font-size: 1.5rem; line-height: 1; }
.editor-icon-btn:hover { border-color: #f0b7b2; background: #fff1f0; }
.editor-empty { padding: 42px 18px; color: var(--editor-muted); text-align: center; }
.editor-savebar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px; border: 1px solid var(--editor-line); border-top: 3px solid var(--editor-accent); background: rgba(255,255,255,.96); box-shadow: 0 -8px 25px rgba(11,27,69,.08); }
.editor-savebar p { margin: 0; }

@media (max-width: 760px) {
  .editor-topbar { min-height: 74px; padding: 10px 16px; }
  .editor-brand img { width: 66px; height: 48px; }
  .editor-brand strong { font-size: .9rem; }
  .editor-brand span { display: none; }
  .editor-main { width: min(100% - 20px, 1180px); padding-top: 24px; }
  .editor-login { padding: 24px 18px; }
  .editor-heading { align-items: flex-start; flex-direction: column; }
  .editor-heading-actions { width: 100%; justify-content: space-between; }
  .editor-stats { grid-template-columns: 1fr; }
  .editor-tools { grid-template-columns: 1fr 1fr; }
  .editor-tools .editor-search { grid-column: 1 / -1; }
  .editor-add { grid-template-columns: 1fr; }
  .editor-list-head, .editor-row { grid-template-columns: 40px minmax(0, 1fr) 40px; gap: 6px; padding-left: 8px; padding-right: 8px; }
  .editor-savebar { align-items: stretch; flex-direction: column; }
  .editor-savebar .editor-btn { width: 100%; }
}
