:root {
  --milk: #fff8ef;
  --paper: #ffffff;
  --foam: #f2e7d8;
  --coffee: #6b3f2a;
  --espresso: #2b1913;
  --blue: #159bb4;
  --green: #238152;
  --amber: #bf7619;
  --red: #c7473e;
  --line: #e2d3c3;
  --muted: #705f55;
  --shadow: 0 12px 26px rgba(70, 42, 22, .09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--milk);
  color: var(--espresso);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
}

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

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #fff8ef 0%, #f0e5d8 100%);
}

.login-panel {
  width: min(440px, 100%);
  padding: 30px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: var(--coffee);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}
.brand-name { font-weight: 800; color: var(--coffee); }
.brand-subtitle, .muted { color: var(--muted); font-size: 14px; }
.login-panel h1 { margin: 28px 0 8px; font-size: 26px; }

.shell { min-width: 0; min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
aside {
  min-width: 0;
  background: var(--espresso);
  color: #fff8ef;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
aside .brand-name { color: #fff8ef; }
aside .brand-subtitle { color: #d8c5b2; }
aside .brand-mark { background: var(--blue); }
nav { display: grid; gap: 6px; }
.nav-button {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #eadbce;
  text-align: left;
}
.nav-button:hover, .nav-button.active { background: #4a2c20; color: #fff; }
.side-meta { margin-top: auto; color: #d8c5b2; font-size: 12px; line-height: 1.55; }

main { min-width: 0; padding: 28px; }
.topbar { display: flex; gap: 18px; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.topbar h1 { margin: 0 0 4px; color: var(--coffee); font-size: 28px; }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 32px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--coffee); background: var(--paper); font-size: 13px; font-weight: 700; }

.view { display: none; }
.view.active { display: block; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-12 { grid-column: span 12; }.span-8 { grid-column: span 8; }.span-7 { grid-column: span 7; }.span-6 { grid-column: span 6; }.span-5 { grid-column: span 5; }.span-4 { grid-column: span 4; }.span-3 { grid-column: span 3; }
.panel, .metric { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 5px 14px rgba(70,42,22,.04); }
.panel { padding: 18px; }
.panel h2 { margin: 0 0 13px; color: var(--coffee); font-size: 18px; }
.panel h3 { margin: 18px 0 9px; font-size: 15px; }
.metric { padding: 16px; }
.metric-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.metric-value { margin-top: 8px; color: var(--espresso); font-size: 26px; font-weight: 800; }

.notice { padding: 11px 12px; border-left: 4px solid var(--blue); background: #eef9fb; color: #245965; font-size: 14px; }
.warning { padding: 11px 12px; border-left: 4px solid var(--amber); background: #fff5e4; color: #745017; font-size: 14px; }
.error { padding: 11px 12px; border-left: 4px solid var(--red); background: #fff0ee; color: #8a2f29; font-size: 14px; }
.success { padding: 11px 12px; border-left: 4px solid var(--green); background: #edf8f1; color: #20613e; font-size: 14px; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.check-grid label { display: flex; align-items: center; gap: 8px; color: var(--espresso); font-size: 13px; }
.check-grid input { width: auto; min-height: auto; padding: 0; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--espresso);
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(21,155,180,.17); border-color: var(--blue); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.button { min-height: 40px; padding: 9px 13px; border: 1px solid transparent; border-radius: 6px; background: var(--coffee); color: #fff; font-weight: 800; }
.button:hover { background: #512d1e; }
.button.secondary { background: #fff; border-color: var(--line); color: var(--coffee); }
.button.danger { background: var(--red); }
.button:disabled { cursor: not-allowed; opacity: .55; }

.table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; letter-spacing: 0; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; align-items: center; justify-content: center; min-height: 26px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status.ok { color: var(--green); background: #e9f6ee; }.status.warn { color: #946000; background: #fff3dc; }.status.bad { color: var(--red); background: #fee8e6; }.status.info { color: #186c7d; background: #e3f7fa; }
.empty { padding: 24px; color: var(--muted); text-align: center; }
.hidden { display: none !important; }
.closing-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.upload-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.upload-row:last-child { border-bottom: 0; }
.upload-row label { color: var(--espresso); }.upload-row input { max-width: 180px; min-height: 34px; padding: 4px; }
.mini-input { width: 86px; min-height: 34px; padding: 6px; }
.recommendation { border-left: 4px solid var(--amber); padding: 10px 12px; background: #fffaf0; margin-bottom: 8px; }
.recommendation strong { display: block; }.recommendation span { color: var(--muted); font-size: 13px; }
.footer-note { margin-top: 22px; color: var(--muted); font-size: 12px; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  aside { gap: 14px; padding: 14px; }
  nav { display: flex; overflow-x: auto; }
  .nav-button { width: auto; min-width: max-content; }
  .side-meta { display: none; }
  main { padding: 20px; }
  .span-8, .span-7, .span-6, .span-5, .span-4, .span-3 { grid-column: span 12; }
  .closing-layout { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  main { padding: 14px; }
  .topbar { display: block; }
  .top-actions { display: grid; grid-template-columns: max-content minmax(0, 1fr); width: 100%; justify-content: initial; margin-top: 12px; }
  .top-actions .chip, .top-actions .button { max-width: 100%; }
  .top-actions .chip:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
  .top-actions .button { grid-column: 1 / -1; justify-self: start; }
  aside nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .nav-button { width: 100%; min-width: 0; white-space: normal; }
  .field-grid { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
  .upload-row { grid-template-columns: 1fr; }
}
