*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #f8f7f4;
  --surface:  #ffffff;
  --border:   #e0dfd8;
  --text:     #1a1a2e;
  --muted:    #6b6a65;
  --primary:  #185FA5;
  --danger:   #A32D2D;
  --warning:  #854F0B;
  --success:  #3B6D11;
  --sidebar-w: 220px;
  --radius:   8px;
}

body { font-family: system-ui, -apple-system, sans-serif; font-size: 14px;
       background: var(--bg); color: var(--text); line-height: 1.6; }

/* ---- LAYOUT ---- */
.app-layout { display: flex; min-height: 100vh; }

.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--surface);
           border-right: 1px solid var(--border); display: flex; flex-direction: column;
           position: sticky; top: 0; height: 100vh; overflow-y: auto; }

.main-content { flex: 1; padding: 32px; overflow-y: auto; max-width: 1200px; }

/* ---- SIDEBAR ---- */
.sidebar-brand { padding: 20px 16px 16px; font-size: 18px; font-weight: 600;
                 border-bottom: 1px solid var(--border); }
.brand-accent  { color: var(--primary); }
.brand-version { font-size: 10px; color: var(--muted); margin-left: 6px; font-weight: 400; }

.client-switcher { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.switcher-label  { font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
                   color: var(--muted); display: block; margin-bottom: 4px; }
.client-switcher select { width: 100%; font-size: 12px; padding: 4px 6px;
                          border: 1px solid var(--border); border-radius: var(--radius); }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item    { display: flex; align-items: center; gap: 10px; padding: 8px 16px;
               font-size: 13px; color: var(--muted); text-decoration: none;
               border-left: 2px solid transparent; transition: all .15s; }
.nav-item:hover  { background: var(--bg); color: var(--text); }
.nav-item.active { background: #E6F1FB; color: var(--primary);
                   border-left-color: var(--primary); font-weight: 500; }
.nav-icon        { font-size: 14px; width: 18px; text-align: center; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.user-info       { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar     { width: 32px; height: 32px; border-radius: 50%; background: #E6F1FB;
                   color: var(--primary); font-size: 11px; font-weight: 600;
                   display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-name       { font-size: 13px; font-weight: 500; }
.user-role       { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.logout-btn      { display: block; text-align: center; font-size: 12px; color: var(--muted);
                   text-decoration: none; padding: 5px; border: 1px solid var(--border);
                   border-radius: var(--radius); }
.logout-btn:hover { background: #FCEBEB; color: var(--danger); border-color: #F09595; }

/* ---- PAGE ---- */
.page-header   { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 600; }
.page-subtitle  { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---- METRICS ---- */
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
                gap: 10px; margin-bottom: 20px; }
.metric-card  { background: var(--bg); border-radius: var(--radius); padding: 14px 16px; }
.metric-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.metric-value { font-size: 24px; font-weight: 600; line-height: 1; }
.metric-sub   { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---- REG GRID ---- */
.reg-grid    { display: grid; grid-template-columns: repeat(2, minmax(0,1fr));
               gap: 12px; margin-bottom: 20px; }
.reg-card    { background: var(--surface); border: 1px solid var(--border);
               border-radius: var(--radius); padding: 16px; }
.reg-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.reg-badge   { font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 4px;
               border: 1px solid; }
.reg-badge-sm { font-size: 10px; font-weight: 500; padding: 2px 6px; border-radius: 3px; }
.reg-pct     { font-size: 20px; font-weight: 600; }
.reg-card-meta { font-size: 12px; color: var(--muted); margin: 8px 0; }

/* ---- PROGRESS ---- */
.progress-bar  { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width .4s; }

/* ---- SECTIONS ---- */
.section-card        { background: var(--surface); border: 1px solid var(--border);
                       border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.section-card.danger { border-color: #F09595; background: #FCEBEB; }
.section-card.warning { border-color: #FAC775; background: #FAEEDA; }
.section-title       { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

.incident-row { display: flex; align-items: center; gap: 10px; padding: 7px 0;
                border-top: 1px solid rgba(0,0,0,.06); text-decoration: none; color: var(--text); }
.incident-row:hover { opacity: .8; }
.expiring-row { display: flex; align-items: center; gap: 10px; padding: 7px 0;
                border-top: 1px solid var(--border); }

/* ---- DOTS ---- */
.dot       { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-red   { background: #E24B4A; }
.dot-amber { background: #EF9F27; }
.dot-green { background: #639922; }

/* ---- BADGES ---- */
.badge         { font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 3px; }
.badge-danger  { background: #F7C1C1; color: #791F1F; }
.badge-warning { background: #FAC775; color: #633806; }
.badge-success { background: #C0DD97; color: #27500A; }
.badge-info    { background: #B5D4F4; color: #0C447C; }

/* ---- BUTTONS ---- */
.btn         { display: inline-block; padding: 7px 16px; border-radius: var(--radius);
               border: 1px solid var(--border); background: transparent; cursor: pointer;
               font-size: 13px; text-decoration: none; color: var(--text); transition: all .15s; }
.btn:hover   { background: var(--bg); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #0C447C; }
.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm      { padding: 4px 10px; font-size: 12px; }
.btn-full    { width: 100%; text-align: center; }

/* ---- FORMS ---- */
.form-group      { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=datetime-local],
select, textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; background: var(--surface); color: var(--text); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(24,95,165,.12); }
textarea { resize: vertical; min-height: 80px; }

/* ---- TABLE ---- */
.data-table  { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 14px; font-size: 11px; font-weight: 500; text-align: left;
                 text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
                 background: var(--bg); border-bottom: 1px solid var(--border); }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.table-wrap  { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* ---- DOCUMENT CHECKLIST ---- */
.doc-area    { background: var(--surface); border: 1px solid var(--border);
               border-radius: var(--radius); padding: 16px; margin-bottom: 10px; }
.doc-area-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.doc-area-title  { font-size: 14px; font-weight: 600; }
.doc-item    { display: flex; align-items: center; gap: 10px; padding: 7px 0;
               border-top: 1px solid var(--border); cursor: pointer; }
.doc-item:hover { background: var(--bg); margin: 0 -16px; padding: 7px 16px; }
.doc-item input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.doc-item-name.done { text-decoration: line-through; color: var(--muted); }
.doc-item-critical { font-size: 10px; color: var(--danger); font-weight: 600; }
.doc-item-check    { margin-left: auto; color: var(--success); font-size: 13px; }

/* ---- INCIDENT DETAIL ---- */
.incident-detail { background: var(--surface); border: 1px solid var(--border);
                   border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.notif-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-top: 16px; }
.notif-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
              cursor: pointer; transition: all .15s; }
.notif-item.done  { border-color: #97C459; background: #EAF3DE; }
.notif-item.done .notif-label  { color: #27500A; }
.notif-item-check { width: 16px; height: 16px; border-radius: 50%; background: var(--border);
                    display: inline-flex; align-items: center; justify-content: center;
                    font-size: 9px; color: #fff; margin-right: 6px; }
.notif-item.done .notif-item-check { background: #639922; }
.notif-label { font-size: 13px; font-weight: 500; }
.notif-desc  { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---- ALERTS ---- */
.alert         { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.alert-danger  { background: #FCEBEB; color: var(--danger); border: 1px solid #F09595; }
.alert-warning { background: #FAEEDA; color: var(--warning); border: 1px solid #FAC775; }
.alert-success { background: #EAF3DE; color: var(--success); border: 1px solid #97C459; }

/* ---- LOGIN ---- */
.login-body      { background: var(--bg); display: flex; align-items: center;
                   justify-content: center; min-height: 100vh; }
.login-container { background: var(--surface); border: 1px solid var(--border);
                   border-radius: 12px; padding: 40px; width: 100%; max-width: 400px; }
.login-brand     { text-align: center; font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.login-tagline   { text-align: center; font-size: 12px; color: var(--muted);
                   margin-bottom: 28px; letter-spacing: .06em; }
.login-form      { display: flex; flex-direction: column; gap: 16px; }
.login-footer    { text-align: center; font-size: 12px; color: var(--muted); margin-top: 20px; }

/* ---- UTILS ---- */
.flex-1     { flex: 1; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 12px; }
.mt-16      { margin-top: 16px; }
.mb-16      { margin-bottom: 16px; }
.flex       { display: flex; }
.gap-8      { gap: 8px; }
.gap-12     { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

@media (max-width: 768px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .reg-grid     { grid-template-columns: 1fr; }
  .sidebar      { display: none; }
  .main-content { padding: 16px; }
}
