:root {
  --primary: #102a4c;
  --primary-dark: #081a31;
  --primary-light: #e6edf7;
  --accent: #ffc107;
  --info: #03a9f4;
  --success: #4caf50;
  --danger: #d32f2f;
  --warning: #f57c00;
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-muted: #f7f8fc;
  --line: #d7dbe8;
  --line-strong: #bdbdbd;
  --text: #212121;
  --muted: #687083;
  --shadow: 0 2px 8px rgba(33, 33, 33, .14);
  --shadow-strong: 0 8px 24px rgba(33, 33, 33, .18);
  --radius: 4px;
  --topbar-height: 64px;
  font-family: "Roboto", "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.app-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.nav-toggle-input, .menu-toggle, .sidebar-close, .sidebar-scrim { display: none; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: 2px 0 8px rgba(33, 33, 33, .08);
}
.brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  min-height: var(--topbar-height);
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
}
.brand img, .login-logo img { width: 42px; height: 42px; object-fit: contain; }
.brand-mark, .login-logo span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.brand strong { display: block; font-size: 13px; line-height: 1.25; font-weight: 700; }
.brand span { display: block; margin-top: 3px; color: rgba(255,255,255,.78); font-size: 11px; line-height: 1.25; }
nav { display: grid; gap: 1px; padding: 8px 0; }
nav a {
  min-height: 36px;
  display: flex;
  align-items: center;
  margin: 0 8px;
  padding: 8px 12px;
  border-left: 3px solid transparent;
  border-radius: 2px;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
}
nav a:hover {
  background: var(--primary-light);
  border-left-color: var(--primary);
  color: var(--primary-dark);
}
.main { min-width: 0; padding: 0 18px 40px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  min-height: var(--topbar-height);
  margin: 0 -18px 16px;
  padding: 10px 18px;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
}
.top-search { flex: 1; max-width: 760px; }
.top-search input {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.32);
  color: #fff;
}
.top-search input::placeholder { color: rgba(255,255,255,.78); }
input, select, textarea, .form-control {
  width: 100%;
  background: #fff;
  color: var(--text);
  border: 1px solid #cfd4e2;
  border-radius: var(--radius);
  padding: 8px 10px;
  outline: none;
  min-height: 34px;
}
textarea { min-height: 112px; resize: vertical; }
textarea.complement { min-height: 66px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(63, 81, 181, .14);
}
.userbox {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255,255,255,.78);
  font-size: 12px;
  white-space: nowrap;
}
.userbox a:first-child { color: #fff; font-weight: 700; }
.guidance {
  margin: 0 0 12px;
  color: #394150;
  background: #fffde7;
  border: 1px solid #ffe082;
  border-left: 4px solid var(--accent);
  padding: 9px 11px;
  border-radius: var(--radius);
  font-size: 13px;
}
.page-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-end; margin: 18px 0 12px; }
h1, h2 { margin: 0; letter-spacing: 0; color: var(--text); }
h1 { font-size: 22px; font-weight: 500; }
h2 { font-size: 15px; margin-bottom: 12px; font-weight: 600; }
.page-head p { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.actions, .form-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid #c5cbe0;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(33,33,33,.08);
}
.btn:hover { background: var(--primary-light); border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.34); color: #fff; box-shadow: none; }
.btn.danger { background: #fff; border-color: #ffcdd2; color: var(--danger); }
.btn.full { width: 100%; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric, .panel, .warning {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.metric {
  position: relative;
  min-height: 86px;
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 3px solid var(--primary);
}
.metric:nth-child(2n) { border-top-color: var(--info); }
.metric:nth-child(3n) { border-top-color: var(--accent); }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { font-size: 26px; color: var(--text); font-weight: 500; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.panel { padding: 14px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; background: #fff; }
th {
  text-align: left;
  color: #424957;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line-strong);
  padding: 9px 8px;
  background: #f2f4fb;
  font-weight: 700;
}
td { border-bottom: 1px solid #e5e8f0; padding: 8px; color: #263238; vertical-align: top; }
tr:hover td { background: #f8f9ff; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.row-actions a, td a { color: var(--primary); font-weight: 700; }
.filters {
  display: flex;
  gap: 9px;
  align-items: end;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
}
.filters p { margin: 0; min-width: 180px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid p, .form-grid label { margin: 0; display: grid; gap: 6px; color: #424957; font-size: 12px; font-weight: 600; }
.form-grid p:has(textarea), .form-grid label:has(textarea), .form-grid .form-actions, .form-grid h2 { grid-column: 1 / -1; }
.form-grid ul { color: var(--muted); margin: 0; padding-left: 18px; }
.error, .message.error { color: var(--danger); }
.messages { display: grid; gap: 8px; margin-bottom: 10px; }
.message {
  padding: 9px 11px;
  border-radius: var(--radius);
  background: #e3f2fd;
  border: 1px solid #90caf9;
  color: #0d47a1;
}
.message.success { background: #e8f5e9; border-color: #a5d6a7; color: #1b5e20; }
.muted { color: var(--muted); }
.detail-list { display: grid; grid-template-columns: 180px 1fr; gap: 0; margin: 0; }
.detail-list dt, .detail-list dd { border-bottom: 1px solid #e5e8f0; padding: 9px 0; margin: 0; }
.detail-list dt { color: var(--muted); font-weight: 600; }
.attachment-list { display: grid; gap: 8px; margin-top: 12px; }
.attachment-list a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}
.danger-line { margin-top: 14px; }
.timeline { display: grid; gap: 9px; }
.timeline article { border-left: 4px solid var(--accent); background: #fff; border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
.timeline time, .timeline span { color: var(--muted); font-size: 12px; display: inline-block; margin-right: 12px; }
.bars { display: grid; gap: 9px; }
.bars div { display: grid; grid-template-columns: 120px 1fr 40px; gap: 8px; align-items: center; color: var(--muted); }
.bars b { display: block; max-width: 100%; min-width: 6px; height: 10px; background: linear-gradient(90deg, var(--accent), var(--info)); border-radius: 999px; }
.pagination { display: flex; justify-content: center; gap: 14px; padding-top: 14px; color: var(--muted); }
.warning { padding: 12px; border-color: #ffcc80; background: #fff8e1; color: #7a4b00; margin-bottom: 12px; }
.summaries-output ol { display: grid; gap: 12px; padding-left: 22px; }
.summaries-output li { line-height: 1.55; color: #263238; }
.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(33, 33, 33, .45); }
.modal-backdrop[hidden] { display: none; }
.modal-panel { width: min(600px, 100%); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-strong); padding: 20px; }
.modal-panel p { color: var(--muted); margin: 4px 0 14px; }
.progress-track { height: 12px; border-radius: 999px; background: #eceff6; border: 1px solid #d7dbe8; overflow: hidden; margin-bottom: 10px; }
.progress-track div { width: 0; height: 100%; background: linear-gradient(90deg, var(--primary), var(--info)); transition: width .25s ease; }
.modal-panel strong { color: var(--text); font-size: 17px; }
.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.data-grid form {
  display: grid;
  grid-template-columns: 1fr 140px 140px auto;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
.data-grid span { color: var(--muted); font-size: 12px; }
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background-color: #071426;
  background-size: cover;
  background-position: center;
  padding: 22px;
}
.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(6,18,34,.22), rgba(3,10,20,.38));
}
.login-card {
  position: relative;
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius);
  background: rgba(5, 14, 27, .72);
  backdrop-filter: blur(14px) saturate(115%);
  box-shadow: 0 24px 70px rgba(0,0,0,.42);
}
.login-logo { display: grid; place-items: center; margin-bottom: 14px; }
.login-card h1 { text-align: center; font-size: 22px; font-weight: 500; color: #f4f7fb; }
.login-card p { color: #b9c5d4; text-align: center; margin: 8px 0 22px; }
.login-card form { display: grid; gap: 13px; }
.login-card label { display: grid; gap: 6px; color: #d6deea; font-size: 12px; font-weight: 600; }
.login-card input {
  background: rgba(4, 12, 24, .7);
  border-color: rgba(192, 207, 226, .26);
  color: #f5f8fc;
}
.login-card input:focus {
  border-color: rgba(255,255,255,.58);
  box-shadow: 0 0 0 2px rgba(3, 169, 244, .18);
}
.login-card small { display: block; margin-top: 16px; color: #aebbcc; line-height: 1.45; text-align: center; }
@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 226px minmax(0, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .data-grid { grid-template-columns: 1fr; }
  .data-grid form { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  :root { --topbar-height: 58px; }
  .app-shell { display: block; overflow-x: hidden; }
  .sidebar {
    position: fixed;
    z-index: 60;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    height: 100dvh;
    transform: translateX(-104%);
    transition: transform .22s ease;
    box-shadow: 24px 0 60px rgba(33,33,33,.3);
  }
  .nav-toggle-input:checked ~ .sidebar { transform: translateX(0); }
  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(33,33,33,.48);
  }
  .nav-toggle-input:checked ~ .sidebar-scrim { display: block; }
  .sidebar-close {
    position: absolute;
    top: 13px;
    right: 10px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: var(--radius);
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 27px;
    line-height: 1;
    cursor: pointer;
  }
  .brand {
    min-height: var(--topbar-height);
    padding-top: 8px;
    padding-bottom: 8px;
    padding-right: 50px;
  }
  .main { padding: 0 12px 32px; }
  .topbar {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    min-height: var(--topbar-height);
    margin: 0 -12px 12px;
    padding: 8px 12px;
  }
  .menu-toggle {
    display: grid;
    place-items: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255,255,255,.34);
    border-radius: var(--radius);
    background: rgba(255,255,255,.14);
    cursor: pointer;
  }
  .menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
  }
  .top-search { max-width: none; }
  .userbox {
    grid-column: 1 / -1;
    justify-content: space-between;
    white-space: normal;
  }
  .page-head, .filters { flex-direction: column; align-items: stretch; }
  .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .detail-list { grid-template-columns: 1fr; }
}
