:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #17211b;
  --muted: #637066;
  --border: #dbe2df;
  --accent: #0f766e;
  --accent-dark: #0b5f58;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --warning: #a15c07;
  --warning-soft: #fff7e6;
  --success: #17663a;
  --success-soft: #edf8f1;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-width: 320px;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-loading {
  padding: 40px;
  color: var(--muted);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-card h1,
.page-title h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.18;
  letter-spacing: 0;
}

.login-card p,
.page-title p {
  color: var(--muted);
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 7px;
  margin: 14px 0;
}

.field label {
  font-size: 13px;
  font-weight: 700;
  color: #314039;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  min-height: 42px;
  padding: 10px 12px;
  outline: none;
}

.field textarea {
  min-height: 104px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.button:hover {
  background: var(--accent-dark);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-light {
  color: var(--text);
  background: #fff;
  border-color: var(--border);
}

.button-light:hover {
  background: var(--surface-soft);
}

.button-danger {
  background: var(--danger);
  border-color: var(--danger);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  background: #10201c;
  color: #e8f1ed;
  padding: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: grid;
  gap: 4px;
  padding: 8px 4px 22px;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  color: #aebdb7;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav button {
  border: 0;
  background: transparent;
  color: #c9d8d2;
  text-align: left;
  border-radius: 6px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 700;
}

.nav button:hover,
.nav button.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-footer {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  color: #aebdb7;
  font-size: 13px;
}

.content {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.page-title {
  display: grid;
  gap: 6px;
}

.page-title h1 {
  font-size: 30px;
}

.page-title p {
  margin: 0;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.04);
}

.stat {
  padding: 18px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat strong {
  display: block;
  font-size: 30px;
  margin-top: 8px;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-header h2,
.panel h2 {
  margin: 0;
  font-size: 18px;
}

.notice {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 6px;
  padding: 12px 14px;
  margin: 12px 0;
  color: var(--muted);
  background: var(--surface-soft);
  line-height: 1.5;
}

.notice strong {
  color: var(--text);
}

.notice-warning {
  border-left-color: var(--warning);
  background: var(--warning-soft);
  color: #70410a;
}

.notice-danger {
  border-left-color: var(--danger);
  background: var(--danger-soft);
  color: #7a1c16;
}

.notice-success {
  border-left-color: var(--success);
  background: var(--success-soft);
  color: #13572f;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #f4f7f6;
  color: #33443c;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:last-child td {
  border-bottom: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #e8eeec;
  color: #2e4038;
}

.tag-new,
.tag-success {
  background: var(--success-soft);
  color: var(--success);
}

.tag-update,
.tag-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.tag-danger,
.tag-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(360px, 1.18fr);
  gap: 16px;
}

.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
}

.inline-form .field {
  margin: 0;
  min-width: 180px;
}

.image-thumb {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #eef2f0;
}

.diff-list,
.issue-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.diff-list li,
.issue-list li {
  font-size: 13px;
  color: var(--muted);
}

.issue-list .error {
  color: var(--danger);
  font-weight: 700;
}

.issue-list .warning {
  color: var(--warning);
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  background: #10201c;
  color: #fff;
  padding: 13px 15px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 40;
  line-height: 1.45;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(12, 19, 17, 0.52);
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px;
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.modal-body {
  color: var(--muted);
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.compare-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.compare-images img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #eef2f0;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar-footer {
    position: static;
    margin-top: 18px;
  }

  .stats,
  .split {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 18px;
  }

  .login-card {
    padding: 22px;
  }

  .page-title h1 {
    font-size: 24px;
  }

  .inline-form {
    display: grid;
  }

  .compare-images {
    grid-template-columns: 1fr;
  }
}
