* { box-sizing: border-box; }
html, body { height: 100%; }
:root { --bg:#0b0e14; --panel:#0f1624; --card:#121826; --border:#1f2937; --text:#e8eaed; --muted:#9aa0a6; --primary:#2563eb; --primary-600:#1d4ed8; --danger:#ef4444; --ok:#10b981; --warn:#f59e0b; }
.light { --bg:#f7f7f7; --panel:#ffffff; --card:#ffffff; --border:#e5e7eb; --text:#111827; --muted:#6b7280; --primary:#2563eb; --primary-600:#1d4ed8; --danger:#b91c1c; --ok:#065f46; --warn:#92400e; }
body { margin: 0; font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--text); display: grid; grid-template-columns: 260px 1fr; grid-template-rows: 56px 1fr 40px; grid-template-areas: 'topbar topbar' 'sidebar content' 'footer footer'; }
.topbar { grid-area: topbar; display:flex; align-items:center; gap:8px; padding:0 16px; background:var(--card); border-bottom:1px solid var(--border); }
.topbar .brand { font-weight:700; letter-spacing:0.5px; }
.topbar .spacer { flex:1; }
.badge { background:var(--primary); color:#fff; padding:2px 8px; border-radius:999px; font-size:0.8em; }
.sidebar { grid-area: sidebar; background:var(--panel); border-right:1px solid var(--border); padding:12px; position:sticky; top:56px; height:calc(100vh - 56px); }
.sidebar a { display:block; padding:10px 12px; margin:4px 0; color:var(--text); text-decoration:none; border-radius:8px; }
.sidebar a:hover { background:var(--border); }
.sidebar a.active { background:var(--primary); }
.sidebar a.admin { color:#93c5fd; }
#content { grid-area: content; padding: 16px; }
.panel { background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:16px; }
.panel.hidden { display:none; }
.panel:target { display:block !important; }
.panel-header h1 { margin:0 0 6px 0; font-size:1.4rem; }
.panel-header .datetime, .panel-header .sub, .muted { color:var(--muted); }
.grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap:12px; }
.card { background:var(--card); border:1px solid var(--border); border-radius:12px; padding:12px; }
.list { list-style:none; padding:0; margin:0; }
.list li { padding:8px 0; border-bottom:1px dashed var(--border); }
.list li:last-child { border-bottom:none; }
.list .meta { display:block; color:var(--muted); font-size:0.9em; }
.table { width:100%; border-collapse: collapse; margin-top:8px; }
.table th, .table td { padding:10px; border-bottom:1px solid var(--border); text-align:left; vertical-align:top; }
.table th { color:var(--muted); font-weight:600; }
.actions { margin-top:16px; display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.btn { background:var(--border); color:var(--text); border:none; padding:10px 14px; border-radius:8px; cursor:pointer; }
.btn:hover { filter:brightness(1.1); }
.btn.primary { background:var(--primary); color:#fff; }
.btn.primary:hover { background:var(--primary-600); }
.btn.ghost { background:transparent; border:1px solid var(--border); }
.btn.small { padding:6px 10px; }
.form-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:12px; }
input, textarea, select { width:100%; background:var(--bg); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:8px; }
input[readonly] { opacity:0.8; }
.error { color:#fca5a5; font-size:0.85em; display:block; min-height:1.2em; }
.field-error { border-color:#f87171 !important; }
.summary { background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:12px; }
.signature { background:#fff; border-radius:8px; border:2px dashed var(--border); width:100%; max-width:600px; }
.sign-preview { display:block; margin-top:10px; max-width:100%; }
.task-card { border-left:4px solid var(--primary); }
.task-card.ok { border-left-color: var(--ok); }
.task-card.warn { border-left-color: var(--warn); }
.footer { grid-area: footer; display:flex; align-items:center; justify-content:center; color:var(--muted); }
.switch { display:flex; align-items:center; gap:8px; }
hr { border:0; border-top:1px solid var(--border); margin:8px 0; }
.app-status { position:sticky; top:56px; z-index:998; background:var(--card); border-bottom:1px solid var(--border); color:var(--muted); padding:8px 16px; }
.app-status.ok { color:#10b981; }
.app-status.err { color:#ef4444; }
@media (max-width: 900px) { body { grid-template-columns: 1fr; grid-template-rows: 56px auto 1fr 40px; grid-template-areas: 'topbar' 'sidebar' 'content' 'footer'; } }
.btn-primary {
  background:#2563eb;
  color:white;
  border:none;
  padding:10px 16px;
  border-radius:6px;
  cursor:pointer;
}

.btn-secondary {
  background:#334155;
  color:white;
  border:none;
  padding:10px 16px;
  border-radius:6px;
  cursor:pointer;
}

.modal {
  position:fixed;
  top:0; left:0;
  width:100%; height:100%;
  background:rgba(0,0,0,0.7);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}

.modal.hidden {
  display:none;
}

.modal-content {
  background:#020617;
  padding:20px;
  border-radius:10px;
  width:400px;
  color:white;
}

.modal-content input,
.modal-content textarea {
  width:100%;
  margin-bottom:10px;
  padding:8px;
  background:#020617;
  color:white;
  border:1px solid #1e293b;
  border-radius:6px;
}

.hidden {
  display: none;
}