*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink:#18181a; --ink2:#45454d; --ink3:#8f8f9a;
  --surface:#f4f3f0; --white:#ffffff; --border:#e4e3de;
  --sidebar-bg:#18181a; --sidebar-t:#ffffff; --sidebar-t2:#aaaaaa;
  --sidebar-hover:rgba(255,255,255,0.07); --sidebar-active:rgba(255,255,255,0.12);
  --accent:#1d5c3a; --accent-l:#eaf4ee; --accent-m:#2d7a50;
  --warn:#c0421a; --warn-l:#fdf0eb;
  --blue:#1a56a0; --blue-l:#eaf0fb;
  --amber:#9a6200; --amber-l:#fef7e5;
  --radius:10px; --radius-sm:7px;
  --sidebar-w: 220px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}
body { font-family:system-ui,-apple-system,'Segoe UI',Roboto,sans-serif; background:var(--surface); color:var(--ink); min-height:100vh; -webkit-font-smoothing:antialiased; overflow-x:hidden; }

/* LOGIN */
#login-screen { min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--sidebar-bg); padding:calc(24px + var(--safe-top)) calc(24px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(24px + var(--safe-left)); }
.login-box { background:var(--white); border-radius:16px; padding:36px 28px 32px; width:100%; max-width:360px; }
.login-logo { display:flex; align-items:center; gap:10px; margin-bottom:24px; }
.login-logo-icon { width:38px; height:38px; background:var(--accent); border-radius:9px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.login-logo-icon svg { color:white; }
.login-logo-text { font-size:14px; font-weight:500; line-height:1.3; }
.login-logo-sub { font-size:11px; color:var(--ink3); }
.login-box h2 { font-size:20px; font-weight:500; margin-bottom:4px; }
.login-sub { font-size:13px; color:var(--ink3); margin-bottom:24px; }

.login-field { margin-bottom:14px; }
.login-field label { display:block; font-size:11px; font-weight:500; letter-spacing:0.04em; text-transform:uppercase; color:var(--ink3); margin-bottom:5px; }
.login-field input { width:100%; padding:11px 13px; border:1px solid var(--border); border-radius:var(--radius-sm); font-family:'Geologica',sans-serif; font-size:15px; color:var(--ink); outline:none; transition:all 0.2s; }
.login-field input:focus { border-color:var(--accent-m); box-shadow:0 0 0 3px rgba(29,92,58,0.1); }
.btn-login { width:100%; padding:13px; background:var(--accent); color:white; border:none; border-radius:var(--radius); font-family:'Geologica',sans-serif; font-size:15px; font-weight:500; cursor:pointer; transition:all 0.2s; }
.btn-login:hover { background:var(--accent-m); }
.btn-login:disabled { opacity:0.6; cursor:not-allowed; }
.login-error { font-size:13px; color:var(--warn); margin-top:10px; text-align:center; display:none; }

/* APP */
#app { display:none; }

/* SIDEBAR OVERLAY (mobile) */
.sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:150; }
.sidebar-overlay.open { display:block; }

/* SIDEBAR */
.sidebar {
  position:fixed; top:0; left:0; bottom:0;
  padding-top:var(--safe-top);
  padding-bottom:var(--safe-bottom);
  width:var(--sidebar-w);
  background:var(--sidebar-bg);
  color:var(--sidebar-t);
  display:flex; flex-direction:column;
  z-index:200;
  transform:translateX(-100%);
  transition:transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.sidebar.open { transform:translateX(0); }
@media (min-width:768px) {
  .sidebar { transform:translateX(0); }
  .sidebar-overlay { display:none !important; }
}
.sidebar-header { padding:18px 16px 14px; border-bottom:1px solid rgba(255,255,255,0.07); }
.sidebar-logo { display:flex; align-items:center; gap:9px; margin-bottom:10px; }
.sidebar-logo-icon { width:30px; height:30px; background:var(--accent); border-radius:7px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.sidebar-logo-text { font-size:12px; font-weight:500; line-height:1.3; }
.sidebar-logo-sub { font-size:10px; color:var(--sidebar-t2); }
.user-badge { display:flex; align-items:center; gap:8px; padding:7px 9px; background:rgba(255,255,255,0.06); border-radius:7px; }
.user-avatar { width:24px; height:24px; background:var(--accent); border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:600; color:white; flex-shrink:0; }
.user-name { font-size:12px; }
.user-role { font-size:10px; color:var(--sidebar-t2); }
.sidebar-nav { flex:1; padding:6px 0; overflow-y:auto; }
.nav-section-label { padding:12px 16px 4px; font-size:9px; font-weight:500; letter-spacing:0.1em; text-transform:uppercase; color:var(--sidebar-t2); }
.nav-item { display:flex; align-items:center; gap:9px; padding:9px 16px; font-size:13px; color:var(--sidebar-t2); cursor:pointer; transition:all 0.15s; user-select:none; -webkit-tap-highlight-color:transparent; }
.nav-item:hover, .nav-item:active { background:var(--sidebar-hover); color:var(--sidebar-t); }
.nav-item.active { background:var(--sidebar-active); color:var(--sidebar-t); }
.nav-item svg { flex-shrink:0; opacity:0.7; }
.nav-item.active svg { opacity:1; }
.nav-badge { margin-left:auto; background:var(--warn); color:white; font-size:10px; font-weight:600; padding:2px 6px; border-radius:10px; min-width:18px; text-align:center; }
.sidebar-footer { padding:10px 16px 14px; border-top:1px solid rgba(255,255,255,0.07); }
.btn-logout { width:100%; padding:8px 10px; background:none; border:1px solid rgba(255,255,255,0.12); border-radius:var(--radius-sm); color:var(--sidebar-t2); font-family:'Geologica',sans-serif; font-size:12px; cursor:pointer; transition:all 0.2s; display:flex; align-items:center; gap:7px; justify-content:center; }
.btn-logout:hover { background:rgba(255,255,255,0.07); color:var(--sidebar-t); }

/* MAIN */
.main-wrap {
  min-height:100vh;
  width:100%;
  max-width:100%;
  padding-left:0;
  transition:padding-left 0.28s cubic-bezier(0.4,0,0.2,1);
}
@media (min-width:768px) {
  .main-wrap { padding-left:var(--sidebar-w); }
}

/* TOPBAR */
.main-topbar {
  background:var(--white);
  border-bottom:1px solid var(--border);
  padding:var(--safe-top) max(16px, var(--safe-right)) 0 max(16px, var(--safe-left));
  min-height:calc(52px + var(--safe-top));
  box-sizing:border-box;
  display:flex; align-items:center; gap:10px;
  position:sticky; top:0; z-index:100;
}
.topbar-menu-btn {
  width:36px; height:36px;
  border:1px solid var(--border); border-radius:8px;
  background:none; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  color:var(--ink2); flex-shrink:0;
}
@media (min-width:768px) { .topbar-menu-btn { display:none; } }
.topbar-title { font-size:15px; font-weight:500; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topbar-actions { display:flex; gap:8px; align-items:center; }
.btn-sm { padding:6px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--white); font-family:'Geologica',sans-serif; font-size:12px; color:var(--ink2); cursor:pointer; transition:all 0.2s; display:flex; align-items:center; gap:5px; white-space:nowrap; }
.btn-sm:hover { background:var(--surface); }
.btn-sm.primary { background:var(--accent); color:white; border-color:transparent; }
.btn-sm.primary:hover { background:var(--accent-m); }
.btn-sm:disabled { opacity:0.6; cursor:not-allowed; }

/* NOTIFICATIONS */
.notif-wrap { position:relative; }
.notif-bell-btn {
  width:36px; height:36px; border:1px solid var(--border); border-radius:8px;
  background:var(--white); cursor:pointer; display:flex; align-items:center; justify-content:center;
  color:var(--ink2); position:relative; padding:0;
}
.notif-bell-btn:hover { background:var(--surface); }
.notif-badge {
  position:absolute; top:-4px; right:-4px; min-width:16px; height:16px; padding:0 4px;
  background:var(--warn); color:#fff; font-size:10px; font-weight:600; border-radius:10px;
  display:flex; align-items:center; justify-content:center; line-height:1;
}
.notif-panel {
  display:none; position:absolute; right:0; top:calc(100% + 8px); width:min(360px, calc(100vw - 32px));
  max-height:420px; background:var(--white); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:0 12px 40px rgba(0,0,0,0.12); z-index:300; overflow:hidden;
}
.notif-panel.open { display:flex; flex-direction:column; }
.notif-panel-head {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:12px 14px; border-bottom:1px solid var(--border); font-size:13px; font-weight:500;
}
.notif-list { overflow-y:auto; flex:1; }
.notif-item {
  display:block; width:100%; text-align:left; border:none; background:none; cursor:pointer;
  padding:12px 14px; border-bottom:1px solid var(--border); font-family:'Geologica',sans-serif;
  transition:background 0.15s;
}
.notif-item:hover { background:var(--surface); }
.notif-item.unread { background:var(--accent-l); }
.notif-item-title { font-size:13px; font-weight:500; color:var(--ink); margin-bottom:3px; }
.notif-item-body { font-size:12px; color:var(--ink3); line-height:1.4; }
.notif-item-time { font-size:11px; color:var(--ink3); margin-top:5px; }
.notif-empty { padding:20px 14px; font-size:13px; color:var(--ink3); text-align:center; }
@media (max-width:767px) {
  .notif-panel {
    position:fixed;
    top:calc(52px + var(--safe-top) + 6px);
    left:max(12px, var(--safe-left));
    right:max(12px, var(--safe-right));
    width:auto;
    max-width:none;
    max-height:min(420px, calc(100dvh - 52px - var(--safe-top) - var(--safe-bottom) - 16px));
  }
  .notif-panel-head {
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }
  .notif-panel-head > div { justify-content:flex-start !important; }
}

/* CREATE MENU */
.create-wrap { position:relative; }
.create-trigger .create-chevron { transition:transform 0.15s; opacity:0.85; }
.create-wrap.open .create-trigger .create-chevron { transform:rotate(180deg); }
.create-menu {
  display:none; position:absolute; right:0; top:calc(100% + 8px);
  width:min(288px, calc(100vw - 32px));
  background:var(--white); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:0 12px 40px rgba(0,0,0,0.12); z-index:300; overflow:hidden; padding:6px 0;
}
.create-wrap.open .create-menu { display:block; }
.create-menu-label {
  padding:8px 14px 4px; font-size:10px; font-weight:600; text-transform:uppercase;
  letter-spacing:0.04em; color:var(--ink3);
}
.create-menu-item {
  display:flex; align-items:flex-start; gap:10px; width:100%;
  padding:10px 14px; border:none; background:none; cursor:pointer;
  font-family:'Geologica',sans-serif; font-size:13px; color:var(--ink);
  text-align:left; transition:background 0.12s;
}
.create-menu-item:hover { background:var(--surface); }
.create-menu-item-icon {
  width:32px; height:32px; border-radius:8px; background:var(--surface);
  border:1px solid var(--border); display:flex; align-items:center; justify-content:center;
  flex-shrink:0; color:var(--accent);
}
.create-menu-item-text { flex:1; min-width:0; }
.create-menu-item-title { font-weight:500; line-height:1.3; margin-bottom:1px; }
.create-menu-item-desc { font-size:11px; color:var(--ink3); line-height:1.35; }
.create-menu-divider { height:1px; background:var(--border); margin:4px 0; }

/* CONTENT */
.main-content { width:100%; max-width:100%; min-width:0; box-sizing:border-box; padding:20px max(16px, var(--safe-right)) calc(40px + var(--safe-bottom)) max(16px, var(--safe-left)); }
@media (min-width:768px) { .main-content { padding:24px max(28px, var(--safe-right)) calc(40px + var(--safe-bottom)) max(28px, var(--safe-left)); } }

/* VIEWS */
.view { display:none; }
.view.active { display:block; }

/* DASHBOARD */
.dash-hero { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:20px; flex-wrap:wrap; }
.dash-greeting { font-size:22px; font-weight:500; line-height:1.25; margin-bottom:4px; color:var(--ink); }
.dash-date { font-size:13px; color:var(--ink3); text-transform:capitalize; }
.dash-hero-actions { display:flex; gap:8px; flex-wrap:wrap; }
.dash-action-btn { display:inline-flex; align-items:center; gap:6px; padding:9px 14px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--white); font-family:'Geologica',sans-serif; font-size:13px; color:var(--ink2); cursor:pointer; transition:all 0.15s; }
.dash-action-btn:hover { border-color:var(--accent-m); color:var(--accent); }
.dash-action-btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
.dash-action-btn.primary:hover { background:var(--accent-m); border-color:var(--accent-m); color:#fff; }
.dash-alert { display:flex; align-items:center; gap:10px; padding:12px 14px; background:var(--warn-l); border:1px solid rgba(192,66,26,0.2); border-radius:var(--radius); margin-bottom:16px; font-size:13px; color:var(--ink); cursor:pointer; }
.dash-alert:hover { border-color:var(--warn); }
.dash-stats { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; margin-bottom:20px; }
@media (min-width:640px) { .dash-stats { grid-template-columns:repeat(4,1fr); } }
.dash-stat { background:var(--white); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; cursor:pointer; transition:all 0.15s; text-align:left; font-family:inherit; width:100%; }
.dash-stat:hover { border-color:var(--accent-m); box-shadow:0 2px 10px rgba(0,0,0,0.04); transform:translateY(-1px); }
.dash-stat.warn { border-color:rgba(192,66,26,0.35); background:#fffaf8; }
.dash-stat-value { font-size:28px; font-weight:500; line-height:1; margin-bottom:4px; color:var(--ink); }
.dash-stat.warn .dash-stat-value { color:var(--warn); }
.dash-stat-label { font-size:12px; font-weight:500; color:var(--ink2); margin-bottom:2px; }
.dash-stat-sub { font-size:11px; color:var(--ink3); }
.dash-main { display:grid; grid-template-columns:1fr; gap:16px; margin-bottom:16px; }
@media (min-width:960px) { .dash-main { grid-template-columns:1.15fr 0.85fr; } }
.dash-panel { background:var(--white); border:1px solid var(--border); border-radius:var(--radius); padding:16px 18px; }
.dash-panel-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:14px; }
.dash-panel-head h2 { font-size:15px; font-weight:500; color:var(--ink); }
.dash-link { border:none; background:none; font-family:'Geologica',sans-serif; font-size:12px; color:var(--accent); cursor:pointer; padding:0; white-space:nowrap; }
.dash-link:hover { text-decoration:underline; }
.dash-week-strip { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; margin-bottom:14px; }
.dash-day-pill { display:flex; flex-direction:column; align-items:center; gap:2px; padding:8px 4px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface); cursor:pointer; font-family:inherit; transition:all 0.12s; min-width:0; }
.dash-day-pill:hover { border-color:var(--accent-m); background:var(--white); }
.dash-day-pill.today { background:var(--accent-l); border-color:var(--accent-m); }
.dash-day-name { font-size:10px; color:var(--ink3); text-transform:uppercase; }
.dash-day-num { font-size:16px; font-weight:500; color:var(--ink); line-height:1; }
.dash-day-pill.today .dash-day-num { color:var(--accent); }
.dash-day-dots { display:flex; gap:3px; margin-top:2px; min-height:6px; }
.dash-day-dots .dot { width:5px; height:5px; border-radius:50%; display:block; }
.dash-day-dots .dot.event { background:var(--blue); }
.dash-day-dots .dot.bday { background:var(--warn); }
.dash-today-list { display:flex; flex-direction:column; gap:8px; margin-bottom:16px; min-height:48px; }
.dash-sched-item { display:flex; align-items:flex-start; gap:12px; padding:11px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); cursor:pointer; transition:background 0.12s; background:var(--surface); }
.dash-sched-item:hover { background:var(--white); border-color:var(--accent-m); }
.dash-sched-item.meeting { border-left:3px solid var(--blue); }
.dash-sched-item.event { border-left:3px solid var(--accent); }
.dash-sched-item.pending { border-left:3px solid var(--warn); background:#fffaf8; }
.dash-sched-item.birthday { border-left:3px solid var(--warn); background:#fffaf5; }
.dash-sched-time { font-size:12px; font-weight:600; color:var(--ink2); min-width:44px; flex-shrink:0; }
.dash-sched-body { flex:1; min-width:0; }
.dash-sched-title { font-size:13px; font-weight:500; color:var(--ink); line-height:1.35; margin-bottom:2px; }
.dash-sched-meta { font-size:11px; color:var(--ink3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-sched-tag { font-size:10px; padding:2px 7px; border-radius:10px; background:var(--white); border:1px solid var(--border); color:var(--ink3); flex-shrink:0; white-space:nowrap; }
.dash-week-label { font-size:11px; font-weight:500; color:var(--ink3); text-transform:uppercase; letter-spacing:0.05em; margin:12px 0 8px; }
.dash-week-preview { display:flex; flex-direction:column; gap:6px; }
.dash-week-row { display:flex; gap:10px; align-items:center; padding:8px 10px; border-radius:var(--radius-sm); cursor:pointer; transition:background 0.12s; }
.dash-week-row:hover { background:var(--surface); }
.dash-week-row-date { font-size:12px; font-weight:500; color:var(--ink2); min-width:52px; }
.dash-week-row-title { font-size:12px; color:var(--ink); flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-attention-block { margin-bottom:16px; }
.dash-attention-block:last-child { margin-bottom:0; }
.dash-attention-title { font-size:11px; font-weight:500; color:var(--ink3); text-transform:uppercase; letter-spacing:0.05em; margin-bottom:8px; display:flex; align-items:center; gap:6px; }
.dash-attention-item { display:flex; gap:10px; align-items:flex-start; padding:10px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); margin-bottom:6px; cursor:pointer; background:var(--surface); transition:all 0.12s; }
.dash-attention-item:hover { background:var(--white); border-color:var(--accent-m); }
.dash-attention-item:last-child { margin-bottom:0; }
.dash-attention-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; margin-top:5px; }
.dash-attention-body { flex:1; min-width:0; }
.dash-attention-title-text { font-size:13px; font-weight:500; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-attention-meta { font-size:11px; color:var(--ink3); margin-top:2px; }
.dash-attention-when { font-size:11px; font-weight:500; flex-shrink:0; white-space:nowrap; }
.dash-sections { display:flex; flex-direction:column; gap:16px; width:100%; min-width:0; }
.dash-panel { width:100%; min-width:0; box-sizing:border-box; }
.dash-stat-progress { height:4px; background:var(--border); border-radius:2px; margin-top:8px; overflow:hidden; }
.dash-stat-progress-bar { height:100%; background:var(--accent); border-radius:2px; transition:width 0.3s; }
.dash-tile-badge-accent { background:#FF6B35; }
.dash-social-preview { border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px 14px; margin-bottom:8px; background:var(--white); }
.dash-social-preview.preview-dim { opacity:0.7; pointer-events:none; }
.dash-social-preview-head { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:6px; }
.dash-social-preview-score { font-size:11px; font-weight:600; color:var(--accent); background:var(--accent-l); padding:2px 8px; border-radius:10px; }
.dash-social-preview-meta { font-size:12px; color:var(--ink3); }
.dash-social-preview-title { font-size:13px; font-weight:500; color:var(--ink); line-height:1.4; margin-bottom:4px; }
.dash-social-preview-ai { font-size:12px; color:var(--ink2); line-height:1.45; margin-bottom:10px; }
.dash-social-preview-actions { display:flex; gap:8px; flex-wrap:wrap; }
.dash-social-more { text-align:center; font-size:12px; color:var(--ink3); padding:6px 0 2px; }
.dash-social-preview.removing { opacity:0; transform:translateX(20px); transition:opacity 0.25s, transform 0.25s; }
.dash-citizen-row { display:flex; gap:10px; align-items:flex-start; padding:10px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); margin-bottom:6px; cursor:pointer; background:var(--surface); transition:all 0.12s; }
.dash-citizen-row:hover { background:var(--white); border-color:var(--accent-m); }
.dash-citizen-row:last-child { margin-bottom:0; }
.dash-citizen-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; margin-top:5px; }
.dash-citizen-dot.done { background:#22C55E; }
.dash-citizen-dot.work { background:#F59E0B; }
.dash-citizen-dot.urgent { background:#DC2626; }
.dash-citizen-body { flex:1; min-width:0; }
.dash-citizen-title { font-size:13px; font-weight:500; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-citizen-meta { font-size:11px; color:var(--ink3); margin-top:2px; }
.dash-med-row { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); margin-bottom:6px; cursor:pointer; background:var(--surface); transition:all 0.12s; }
.dash-med-row:hover { background:var(--white); border-color:var(--accent-m); }
.dash-med-row:last-child { margin-bottom:0; }
.dash-med-info { flex:1; min-width:0; }
.dash-med-name { font-size:13px; font-weight:500; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-med-drug { font-size:11px; color:var(--ink3); margin-top:2px; }
.dash-med-status { font-size:10px; font-weight:600; padding:3px 8px; border-radius:10px; background:#FFFBEB; color:#B45309; flex-shrink:0; }
.dash-tile { padding:14px 16px; border:1px solid var(--border); border-radius:var(--radius); cursor:pointer; transition:all 0.12s; background:var(--white); min-width:0; }
.dash-tile:hover { border-color:var(--accent-m); box-shadow:0 2px 8px rgba(0,0,0,0.04); }
.dash-tile-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.dash-tile-title { font-size:13px; font-weight:500; color:var(--ink); }
.dash-tile-badge { font-size:10px; font-weight:600; background:var(--warn); color:#fff; padding:2px 7px; border-radius:10px; }
.dash-tile-item { font-size:12px; color:var(--ink2); padding:6px 0; border-top:1px solid var(--border); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-tile-item:first-of-type { border-top:none; padding-top:0; }
.dash-empty { font-size:13px; color:var(--ink3); padding:8px 0; }

@media (max-width:767px) {
  .main-content { padding-left:max(12px, var(--safe-left)); padding-right:max(12px, var(--safe-right)); }
  .dash-panel { padding:14px 14px; }
  .dash-week-strip { gap:4px; }
  .dash-day-pill { padding:7px 2px; }
  .dash-day-num { font-size:15px; }
  .dash-social-preview-actions { flex-direction:column; }
  .dash-social-preview-actions .btn-sm { width:100%; justify-content:center; }
  .dash-panel-head h2 { font-size:14px; }
}

/* FILTERS */
.filter-bar { display:flex; gap:7px; margin-bottom:16px; overflow-x:auto; padding-bottom:4px; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
.filter-bar::-webkit-scrollbar { display:none; }
.filter-chip { padding:5px 12px; border:1px solid var(--border); border-radius:20px; font-size:12px; background:var(--white); color:var(--ink2); cursor:pointer; transition:all 0.15s; user-select:none; white-space:nowrap; flex-shrink:0; -webkit-tap-highlight-color:transparent; }
.filter-chip.active { background:var(--ink); border-color:var(--ink); color:white; }

/* CARDS (mobile appeals) */
.appeals-cards { display:flex; flex-direction:column; gap:10px; }
.appeal-card { background:var(--white); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; cursor:pointer; transition:box-shadow 0.15s; -webkit-tap-highlight-color:transparent; }
.appeal-card:active { box-shadow:0 2px 8px rgba(0,0,0,0.08); }
.appeal-card-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.appeal-card-num { font-size:11px; color:var(--ink3); font-weight:500; }
.appeal-card-date { font-size:11px; color:var(--ink3); }
.appeal-card-addr { font-size:14px; font-weight:500; color:var(--ink); margin-bottom:5px; }
.appeal-card-preview { font-size:12px; color:var(--ink3); line-height:1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin-bottom:8px; }
.appeal-card-footer { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.appeal-card-assignee { font-size:11px; color:var(--ink3); margin-left:auto; }

/* TABLE (desktop) */
.appeals-table { display:none; }
@media (min-width:768px) {
  .appeals-table { display:table; width:100%; border-collapse:collapse; background:var(--white); border-radius:var(--radius); overflow:hidden; border:1px solid var(--border); }
  .appeals-cards { display:none; }
}
.appeals-table th { text-align:left; font-size:11px; font-weight:500; color:var(--ink3); text-transform:uppercase; letter-spacing:0.04em; padding:11px 14px; border-bottom:1px solid var(--border); background:var(--surface); }
.appeals-table td { padding:12px 14px; font-size:13px; border-bottom:1px solid var(--border); vertical-align:top; }
.appeals-table tr:last-child td { border-bottom:none; }
.appeals-table tbody tr { transition:background 0.15s; cursor:pointer; }
.appeals-table tbody tr:hover { background:#f9f8f5; }
.appeal-num { font-weight:500; font-size:11px; color:var(--ink3); }
.appeal-addr { font-weight:500; font-size:13px; }
.appeal-preview { font-size:12px; color:var(--ink3); margin-top:2px; max-width:220px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.agencies-table-wrap { overflow-x:auto; }
.agencies-table { display:table; width:100%; min-width:640px; border-collapse:collapse; background:var(--white); border-radius:var(--radius); border:1px solid var(--border); }
.agencies-table th { text-align:left; font-size:11px; font-weight:500; color:var(--ink3); text-transform:uppercase; letter-spacing:0.04em; padding:11px 14px; border-bottom:1px solid var(--border); background:var(--surface); }
.agencies-table td { padding:12px 14px; font-size:13px; border-bottom:1px solid var(--border); vertical-align:top; }
.agencies-table tr:last-child td { border-bottom:none; }
.agencies-table tbody tr:hover { background:#f9f8f5; }
.agency-actions { display:flex; gap:6px; flex-wrap:wrap; }

.archive-table-wrap { overflow:auto; max-height:calc(100vh - 220px); border-radius:var(--radius); border:1px solid var(--border); background:var(--white); }
.archive-table { width:100%; min-width:960px; table-layout:fixed; border-collapse:collapse; }
.archive-table th { text-align:left; font-size:11px; font-weight:500; color:var(--ink3); text-transform:uppercase; letter-spacing:0.04em; padding:10px 12px; border-bottom:1px solid var(--border); background:var(--surface); position:sticky; top:0; z-index:1; }
.archive-table td { padding:10px 12px; font-size:13px; border-bottom:1px solid var(--border); vertical-align:top; line-height:1.4; }
.archive-table tbody tr { cursor:pointer; transition:background 0.12s; }
.archive-table tbody tr:nth-child(even) { background:#faf9f7; }
.archive-table tbody tr:hover { background:#f3f1ec; }
.archive-table tbody tr:last-child td { border-bottom:none; }
.archive-table .col-date { width:92px; white-space:nowrap; color:var(--ink2); font-size:12px; }
.archive-table .col-num { width:108px; font-size:11px; color:var(--ink3); font-weight:500; word-break:break-all; }
.archive-table .col-name { width:15%; font-weight:500; color:var(--ink); }
.archive-table .col-phone { width:118px; white-space:nowrap; font-size:12px; color:var(--ink2); }
.archive-table .col-addr { width:24%; font-size:12px; color:var(--ink2); }
.archive-table .col-topic { width:auto; }
.archive-table .col-actions { width:76px; padding-left:4px; padding-right:8px; }
.archive-table .addr-text { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.archive-table .addr-badge { display:inline-block; margin-top:4px; }
.archive-table .topic-main { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; font-size:13px; color:var(--ink); }
.archive-table .topic-sub { font-size:11px; color:var(--ink3); margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.archive-table .archive-actions { display:flex; gap:4px; justify-content:flex-end; align-items:center; }
.archive-table .archive-actions .btn-sm { padding:4px 8px; font-size:11px; white-space:nowrap; }
.archive-table .archive-actions .btn-icon { width:28px; height:28px; padding:0; display:inline-flex; align-items:center; justify-content:center; font-size:14px; line-height:1; }

.citizen-appeals-grid { display:grid; grid-template-columns:1fr; gap:12px; }
@media (min-width:768px) { .citizen-appeals-grid { grid-template-columns:1fr 1fr; } }
.citizen-card { background:var(--white); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; cursor:pointer; transition:all 0.15s; }
.citizen-card:hover { border-color:var(--accent-m); box-shadow:0 2px 8px rgba(0,0,0,0.04); }
.citizen-card.urgent { border-left:3px solid var(--warn); }
.citizen-card-title { font-size:14px; font-weight:500; margin-bottom:4px; line-height:1.3; }
.citizen-card-summary { font-size:12px; color:var(--ink3); line-height:1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin-bottom:8px; }
.citizen-card-footer { display:flex; gap:6px; flex-wrap:wrap; align-items:center; font-size:11px; color:var(--ink3); }
.citizen-card-assignee { font-size:11px; color:var(--ink2); margin-bottom:6px; }
.citizen-card-assignee.unassigned { color:var(--ink3); font-style:italic; }
.dash-citizen-assignee { margin-top:2px; }
.cc-photos-preview { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:8px; }
.cc-photo-thumb { position:relative; width:72px; height:72px; border-radius:var(--radius-sm); overflow:hidden; border:1px solid var(--border); background:var(--surface); }
.cc-photo-thumb img { width:100%; height:100%; object-fit:cover; }
.cc-photo-thumb button { position:absolute; top:2px; right:2px; width:20px; height:20px; border:none; border-radius:50%; background:rgba(0,0,0,0.55); color:#fff; font-size:12px; line-height:1; cursor:pointer; }
.analyze-block { background:var(--surface); border-radius:var(--radius-sm); padding:12px; margin-bottom:14px; }
.analyze-agencies .ai-badge { font-size:10px; color:var(--accent, #3b82f6); font-weight:600; text-transform:uppercase; letter-spacing:0.04em; white-space:nowrap; }
.cc-agencies-hint { font-size:12px; color:var(--ink3); margin-bottom:8px; }
.agency-picker { border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--white); padding:10px; }
.agency-picker-selected { display:flex; flex-wrap:wrap; gap:6px; min-height:28px; margin-bottom:10px; }
.agency-picker-empty { font-size:12px; color:var(--ink3); padding:4px 0; }
.agency-chip { display:inline-flex; align-items:center; gap:6px; max-width:100%; padding:5px 8px 5px 10px; border-radius:20px; background:var(--accent-l); color:var(--accent); font-size:12px; line-height:1.3; }
.agency-chip.ai { background:var(--blue-l); color:var(--blue); }
.agency-chip button { border:none; background:rgba(0,0,0,0.08); color:inherit; width:18px; height:18px; border-radius:50%; cursor:pointer; font-size:14px; line-height:1; flex-shrink:0; padding:0; }
.agency-chip button:hover { background:rgba(0,0,0,0.15); }
.agency-picker-search { width:100%; padding:9px 11px; border:1px solid var(--border); border-radius:var(--radius-sm); font-family:'Geologica',sans-serif; font-size:13px; outline:none; background:var(--surface); }
.agency-picker-search:focus { border-color:var(--accent-m); background:var(--white); }
.agency-picker-suggest { display:flex; flex-direction:column; gap:4px; max-height:200px; overflow-y:auto; margin-top:8px; }
.agency-picker-item { display:flex; flex-direction:column; align-items:flex-start; gap:2px; width:100%; text-align:left; padding:8px 10px; border:1px solid transparent; border-radius:var(--radius-sm); background:transparent; cursor:pointer; font-family:'Geologica',sans-serif; transition:background 0.15s; }
.agency-picker-item:hover { background:var(--surface); border-color:var(--border); }
.agency-picker-item.ai { background:rgba(59,130,246,0.06); }
.agency-picker-item-name { font-size:13px; color:var(--ink); line-height:1.35; }
.agency-picker-item-meta { font-size:11px; color:var(--ink3); line-height:1.3; }
.agency-picker-unmatched { margin-top:8px; font-size:12px; color:var(--warn); line-height:1.4; }
.outgoing-list { display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.outgoing-item { border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; background:var(--white); }
.outgoing-item-head { display:flex; justify-content:space-between; gap:8px; align-items:flex-start; flex-wrap:wrap; }
.outgoing-item-actions { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
.urgent-toggle { display:flex; align-items:center; gap:8px; margin:10px 0; font-size:13px; }

/* BADGES */
.badge { display:inline-flex; align-items:center; padding:3px 8px; border-radius:20px; font-size:11px; font-weight:500; white-space:nowrap; }
.badge-new { background:#eaf0fb; color:#1a56a0; }
.badge-work { background:#fef7e5; color:#9a6200; }
.badge-done { background:var(--accent-l); color:var(--accent); }
.badge-wait { background:#f4f3f0; color:#6b6b73; }
.badge-pharmacy { background:#f0faf4; color:#1d5c3a; font-weight:600; }
.badge-new-msg { background:var(--warn); color:#fff; font-size:10px; padding:1px 6px; border-radius:10px; font-weight:600; }
.badge-high { background:#fdf0eb; color:var(--warn); }
.badge-medium { background:#fef7e5; color:#9a6200; }
.badge-low { background:#f4f3f0; color:#6b6b73; }
.badge-meeting { background:#f0eaff; color:#6b35c4; }
.badge-meeting-done { background:#e8f5ff; color:#0a6fa8; }
.badge-warn { background:#fdf0eb; color:var(--warn); }
.badge-district { background:var(--accent-l); color:var(--accent); border:1px solid var(--accent-m); font-weight:500; }
.badge-blue { background:var(--blue-l); color:var(--blue); }

/* DETAIL PANEL */
#appeal-detail {
  position:fixed; inset:0;
  background:var(--white);
  z-index:250;
  display:none; flex-direction:column;
  transform:translateX(100%);
  transition:transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
#appeal-detail.open { display:flex; transform:translateX(0); }

@media (max-width: 767px) {
  #appeal-detail {
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
  }
  #appeal-detail .detail-header {
    padding-top: 16px;
  }
  #appeal-detail .reply-area {
    padding-bottom: calc(12px + var(--safe-bottom));
  }
}

@media (min-width:768px) {
  #appeal-detail {
    inset:auto; right:0; top:0; bottom:0;
    width:500px;
    border-left:1px solid var(--border);
    box-shadow:-8px 0 32px rgba(0,0,0,0.08);
    transform:translateX(100%);
  }
  #appeal-detail.open { transform:translateX(0); }
}
.detail-header { padding:16px 18px 14px; border-bottom:1px solid var(--border); flex-shrink:0; }
.detail-header-top { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.btn-back-detail { width:32px; height:32px; border:1px solid var(--border); border-radius:7px; background:none; cursor:pointer; display:flex; align-items:center; justify-content:center; color:var(--ink2); flex-shrink:0; -webkit-tap-highlight-color:transparent; }
.detail-num { font-size:12px; color:var(--ink3); flex:1; }
.detail-title { font-size:16px; font-weight:500; line-height:1.3; margin-bottom:8px; }
.detail-meta { display:flex; gap:6px; flex-wrap:wrap; }
.detail-body { flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch; }
.detail-section { padding:16px 18px; border-bottom:1px solid var(--border); }
.detail-section:last-child { border-bottom:none; }
.detail-section-title { font-size:10px; font-weight:500; text-transform:uppercase; letter-spacing:0.08em; color:var(--ink3); margin-bottom:10px; }
.detail-field { display:flex; gap:8px; margin-bottom:9px; font-size:13px; }
.detail-field-label { color:var(--ink3); min-width:110px; flex-shrink:0; font-size:12px; }
.detail-field-val { color:var(--ink); }
.detail-text-block { margin-top:8px; font-size:13px; color:var(--ink2); line-height:1.6; background:var(--surface); border-radius:var(--radius-sm); padding:10px 12px; }
.history-item { display:flex; gap:10px; margin-bottom:14px; }
.history-dot-col { display:flex; flex-direction:column; align-items:center; }
.history-dot { width:9px; height:9px; border-radius:50%; background:var(--accent); flex-shrink:0; margin-top:3px; }
.history-line { flex:1; width:1px; background:var(--border); margin:3px 0; }
.history-item:last-child .history-line { display:none; }
.history-date { font-size:11px; color:var(--ink3); margin-bottom:1px; }
.history-text { font-size:13px; color:var(--ink2); line-height:1.5; }
.history-author { font-size:11px; color:var(--ink3); margin-top:1px; }
.file-link { display:flex; align-items:center; gap:8px; padding:8px 11px; background:var(--accent-l); border:1px solid rgba(29,92,58,0.2); border-radius:var(--radius-sm); margin-bottom:7px; font-size:13px; color:var(--accent); text-decoration:none; }
.file-link:hover { background:#d8eee0; }
.reply-area { padding:12px 18px; border-top:1px solid var(--border); flex-shrink:0; background:var(--white); }
.reply-area textarea { width:100%; padding:9px 11px; border:1px solid var(--border); border-radius:var(--radius-sm); font-family:'Geologica',sans-serif; font-size:13px; color:var(--ink); resize:none; height:66px; outline:none; transition:all 0.2s; }
.reply-area textarea:focus { border-color:var(--accent-m); box-shadow:0 0 0 3px rgba(29,92,58,0.08); }
.reply-actions { display:flex; gap:8px; margin-top:7px; justify-content:flex-end; }

/* SELECT fields */
.field-select { width:100%; padding:8px 11px; border:1px solid var(--border); border-radius:var(--radius-sm); font-family:'Geologica',sans-serif; font-size:13px; color:var(--ink); background:var(--white); outline:none; cursor:pointer; }
.selects-row { display:flex; gap:10px; flex-wrap:wrap; }
.selects-row select { flex:1; min-width:140px; }

/* Meetings */
.meeting-card { background:var(--white); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; margin-bottom:10px; display:flex; gap:14px; align-items:flex-start; }
.meeting-date-block { min-width:48px; text-align:center; background:var(--accent-l); border-radius:8px; padding:7px; flex-shrink:0; }
.meeting-day { font-size:20px; font-weight:600; color:var(--accent); line-height:1; }
.meeting-month { font-size:10px; color:var(--accent-m); text-transform:uppercase; letter-spacing:0.05em; margin-top:2px; }
.meeting-info { flex:1; min-width:0; }
.meeting-title { font-size:13px; font-weight:500; color:var(--ink); margin-bottom:3px; }
.meeting-meta { font-size:12px; color:var(--ink3); }
.meeting-actions { display:flex; flex-direction:column; gap:5px; align-items:flex-end; flex-shrink:0; }
.meeting-status { font-size:11px; padding:2px 7px; border-radius:10px; font-weight:500; white-space:nowrap; }
.meeting-planned { background:var(--blue-l); color:var(--blue); }
.meeting-done { background:var(--accent-l); color:var(--accent); }
.meeting-cancelled { background:#f4f3f0; color:var(--ink3); }
.section-label { font-size:11px; font-weight:500; color:var(--ink3); text-transform:uppercase; letter-spacing:0.06em; margin-bottom:10px; margin-top:4px; }

/* Calendar */
.cal-toolbar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:14px; }
.cal-month-label { font-size:16px; font-weight:500; min-width:160px; }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; margin-bottom:16px; }
.cal-dow { font-size:10px; color:var(--ink3); text-align:center; padding:4px; text-transform:uppercase; }
.cal-day { min-height:52px; border:1px solid var(--border); border-radius:var(--radius-sm); padding:4px; background:var(--white); cursor:pointer; font-size:12px; }
.cal-day.other { opacity:0.45; background:var(--surface); }
.cal-day.today { border-color:var(--accent-m); box-shadow:inset 0 0 0 1px var(--accent-m); }
.cal-day.selected { background:var(--accent-l); border-color:var(--accent); }
.cal-day-num { font-weight:500; margin-bottom:2px; }
.cal-day-dots { display:flex; gap:3px; flex-wrap:wrap; }
.cal-dot { width:6px; height:6px; border-radius:50%; background:var(--accent); }
.cal-dot.meeting { background:var(--blue); }
.cal-dot.pending { background:var(--warn); }
.cal-dot.birthday { background:#f0a050; }
.cal-feed-box { background:var(--accent-l); border:1px solid var(--accent-m); border-radius:var(--radius-sm); padding:10px 12px; margin-bottom:14px; font-size:12px; }
.cal-feed-url { word-break:break-all; font-family:monospace; font-size:11px; margin:6px 0; }
.cal-view-toggle { display:flex; gap:4px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:2px; }
.cal-view-toggle button { border:none; background:transparent; padding:5px 10px; font-size:12px; font-family:'Geologica',sans-serif; color:var(--ink3); cursor:pointer; border-radius:5px; }
.cal-view-toggle button.active { background:var(--white); color:var(--ink); box-shadow:0 1px 3px rgba(0,0,0,0.06); }
.cal-week-wrap { border:1px solid var(--border); border-radius:var(--radius); background:var(--white); overflow:auto; margin-bottom:16px; }
.cal-week-header { display:grid; grid-template-columns:48px repeat(7,1fr); border-bottom:1px solid var(--border); min-width:720px; position:sticky; top:0; background:var(--white); z-index:2; }
.cal-week-hcell { padding:8px 6px; text-align:center; border-left:1px solid var(--border); font-size:11px; color:var(--ink3); }
.cal-week-hcell.today { background:var(--accent-l); color:var(--accent); font-weight:500; }
.cal-week-hcell .cal-wh-day { font-size:18px; font-weight:500; color:var(--ink); line-height:1.1; }
.cal-week-hcell.today .cal-wh-day { color:var(--accent); }
.cal-week-body { display:grid; grid-template-columns:48px 1fr; min-width:720px; }
.cal-week-times { border-right:1px solid var(--border); }
.cal-week-time { height:48px; font-size:10px; color:var(--ink3); text-align:right; padding:2px 6px 0 0; border-bottom:1px solid var(--surface); box-sizing:border-box; }
.cal-week-days { display:grid; grid-template-columns:repeat(7,1fr); position:relative; }
.cal-week-col { position:relative; border-left:1px solid var(--border); background:repeating-linear-gradient(to bottom, transparent, transparent 47px, var(--surface) 47px, var(--surface) 48px); min-height:576px; }
.cal-week-col.today { background-color:rgba(234,244,238,0.35); background-image:repeating-linear-gradient(to bottom, transparent, transparent 47px, rgba(228,227,222,0.5) 47px, rgba(228,227,222,0.5) 48px); }
.cal-week-event { position:absolute; left:2px; right:2px; border-radius:5px; padding:4px 6px; font-size:11px; line-height:1.35; overflow:hidden; cursor:pointer; border-left:3px solid var(--accent); background:rgba(29,92,58,0.12); color:var(--ink); z-index:1; box-shadow:0 1px 2px rgba(0,0,0,0.04); }
.cal-week-event.meeting { border-left-color:var(--blue); background:rgba(26,86,160,0.1); }
.cal-week-event.pending { border-left-color:var(--warn); background:rgba(192,66,26,0.1); }
.cal-week-event .cal-we-time { font-weight:600; font-size:10px; color:var(--ink2); margin-bottom:2px; }
.cal-week-event .cal-we-title { font-weight:500; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.cal-week-event .cal-we-addr { font-size:10px; color:var(--ink3); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cal-week-allday { display:grid; grid-template-columns:48px repeat(7,1fr); border-bottom:1px solid var(--border); min-width:720px; min-height:36px; background:#fffaf5; }
.cal-week-allday-label { font-size:14px; text-align:center; padding:6px 4px; color:var(--warn); border-right:1px solid var(--border); }
.cal-week-allday-col { border-left:1px solid var(--border); padding:4px; display:flex; flex-direction:column; gap:3px; }
.cal-birthday-pill { font-size:10px; line-height:1.3; padding:3px 6px; border-radius:4px; background:#fff3e6; border:1px solid #f0c9a8; color:var(--ink); cursor:pointer; }
.cal-birthday-pill:hover { background:#ffe8d4; }
.ce-file-row { display:flex; align-items:center; gap:8px; margin:4px 0; font-size:12px; }
.ce-file-pending { color:var(--ink3); font-size:12px; margin:4px 0; }
@media (max-width:900px) { .cal-week-wrap { font-size:10px; } .cal-week-event { padding:3px 4px; } }

/* Citizen appeal bottom sheet */
.cd-overlay {
  position:fixed; inset:0;
  background:rgba(0,0,0,0.4);
  z-index:400;
  display:none;
  align-items:flex-end;
  justify-content:center;
  font-family:inherit;
}
.cd-overlay.open { display:flex; }
.cd-sheet {
  background:var(--white);
  border-radius:18px 18px 0 0;
  width:100%;
  max-width:430px;
  max-height:92vh;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.cd-handle {
  width:36px; height:4px;
  background:var(--border);
  border-radius:2px;
  margin:10px auto 0;
  flex-shrink:0;
}
.cd-header { padding:10px 16px 0; flex-shrink:0; }
.cd-header-top { display:flex; align-items:flex-start; justify-content:space-between; gap:8px; }
.cd-header-title { font-size:15px; font-weight:700; color:var(--ink); line-height:1.3; flex:1; }
.cd-header-actions { display:flex; gap:6px; position:relative; flex-shrink:0; }
.cd-icon-btn {
  width:28px; height:28px;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--surface);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; font-size:14px; color:var(--ink3);
  -webkit-tap-highlight-color:transparent;
}
.cd-header-ref { font-size:11px; color:var(--ink3); margin-top:6px; }
.cd-header-badges { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
.cd-more-menu {
  position:absolute; top:34px; right:0;
  background:var(--white);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:0 4px 20px rgba(0,0,0,0.12);
  z-index:10;
  overflow:hidden;
  min-width:220px;
}
.cd-more-item {
  display:flex; align-items:center; gap:8px;
  width:100%; padding:11px 16px;
  font-size:13px; font-weight:500; color:var(--ink);
  background:none; border:none; border-bottom:1px solid var(--border);
  cursor:pointer; text-align:left;
}
.cd-more-item:last-child { border-bottom:none; }
.cd-more-danger { color:#DC2626; }
.cd-tabs {
  display:flex;
  border-bottom:1px solid var(--border);
  margin-top:12px;
  padding:0 16px;
  flex-shrink:0;
}
.cd-tab {
  flex:1; padding:9px 4px 8px;
  text-align:center; font-size:13px; font-weight:400;
  color:var(--ink3);
  background:none; border:none;
  border-bottom:2px solid transparent;
  cursor:pointer; margin-bottom:-1px;
  transition:all 0.15s;
  -webkit-tap-highlight-color:transparent;
}
.cd-tab.active { font-weight:600; color:var(--accent); border-bottom-color:var(--accent); }
.cd-tab-panel { display:none; flex:1; flex-direction:column; min-height:0; overflow:hidden; }
.cd-tab-panel.active { display:flex; }
#cd-tab-details {
  overflow-y:auto; padding:14px 16px; -webkit-overflow-scrolling:touch;
  display:block; /* не flex — иначе блок текста сжимается до одной строки */
}
.cd-meta-table { width:100%; margin-bottom:14px; }
.cd-meta-row {
  display:flex; gap:8px; padding:7px 0;
  border-bottom:1px solid var(--border);
  align-items:flex-start;
}
.cd-meta-key { font-size:12px; color:var(--ink3); width:110px; flex-shrink:0; padding-top:1px; }
.cd-meta-val { font-size:13px; color:var(--ink); font-weight:500; flex:1; line-height:1.3; }
.cd-meta-link { font-size:13px; color:var(--accent); font-weight:500; flex:1; text-decoration:none; }
.cd-meta-select {
  font-size:13px; font-weight:500; color:var(--ink);
  border:1px solid var(--border); border-radius:8px;
  padding:4px 8px; background:var(--surface);
  flex:1; cursor:pointer;
}
.cd-section-label {
  font-size:10px; font-weight:700;
  letter-spacing:0.6px; text-transform:uppercase;
  color:var(--ink3); margin-bottom:8px; margin-top:14px;
}
.cd-section-label:first-child { margin-top:0; }
.cd-problem-box {
  background:var(--surface2);
  border:1px solid var(--border);
  border-radius:10px;
  padding:14px 16px;
  font-size:14px;
  line-height:1.65;
  color:var(--ink);
  white-space:pre-wrap;
  word-break:break-word;
  min-height:140px;
  max-height:min(52vh, 520px);
  overflow-y:auto;
  flex-shrink:0;
}
.cd-summary-box {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:10px;
  padding:12px 14px;
  font-size:14px; color:var(--ink2);
  line-height:1.6;
  white-space:pre-wrap;
  word-break:break-word;
  flex-shrink:0;
}
.cd-ai-btn {
  display:flex; align-items:center; justify-content:center; gap:6px;
  width:100%; margin-top:8px;
  padding:8px 14px; border-radius:10px;
  background:var(--accent); color:#fff;
  font-size:13px; font-weight:600;
  border:none; cursor:pointer;
}
.cd-add-dept-btn {
  display:flex; align-items:center; justify-content:center; gap:6px;
  width:100%; margin-top:8px;
  padding:8px 14px; border-radius:10px;
  background:var(--surface); color:var(--ink2);
  font-size:13px; font-weight:500;
  border:1px dashed var(--border); cursor:pointer;
}
.cd-agency-item { font-size:13px; padding:4px 0; }
.cd-agency-response {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:10px 12px; margin-top:6px;
}
.cd-chat-scroll { flex:1; overflow-y:auto; padding:14px 16px; -webkit-overflow-scrolling:touch; }
.cd-timeline-item { display:flex; gap:10px; padding:7px 0; border-bottom:1px solid var(--border); align-items:flex-start; }
.cd-timeline-dot { width:8px; height:8px; border-radius:50%; margin-top:5px; flex-shrink:0; }
.cd-timeline-time { font-size:11px; color:var(--ink3); margin-bottom:2px; }
.cd-timeline-text { font-size:13px; color:var(--ink); line-height:1.4; }
.cd-timeline-author { font-size:11px; color:var(--ink3); margin-top:2px; }
.cd-comment-section { margin-top:12px; }
.cd-comment-row { display:flex; gap:8px; margin-top:6px; }
.cd-comment-input {
  flex:1; border:1px solid var(--border); border-radius:8px;
  padding:8px 10px; font-size:13px; color:var(--ink);
  background:var(--surface); font-family:inherit; outline:none;
}
.cd-comment-send {
  padding:8px 14px; border-radius:8px;
  background:var(--accent); color:#fff;
  font-size:13px; font-weight:600;
  border:none; cursor:pointer;
}
.cd-reply-area {
  flex-shrink:0;
  border-top:1px solid var(--border);
  padding:10px 16px max(16px, env(safe-area-inset-bottom));
  background:var(--white);
}
.cd-reply-email { font-size:11px; color:var(--ink3); margin-bottom:6px; }
.cd-hint-input {
  width:100%; border:1px solid var(--border); border-radius:8px;
  padding:7px 10px; font-size:12px; color:var(--ink2);
  background:var(--surface); margin-bottom:6px;
  box-sizing:border-box; font-family:inherit; resize:none; outline:none;
}
.cd-reply-input {
  width:100%; border:1px solid var(--border); border-radius:8px;
  padding:8px 10px; font-size:13px; color:var(--ink);
  background:var(--white); margin-bottom:8px;
  box-sizing:border-box; font-family:inherit; resize:none; outline:none;
  min-height:72px;
}
.cd-reply-actions { display:flex; gap:6px; }
.cd-reply-btn {
  padding:8px 12px; border-radius:8px;
  background:var(--surface); border:1px solid var(--border);
  font-size:12px; font-weight:500; color:var(--ink); cursor:pointer;
}
.cd-reply-btn-send {
  flex:1; padding:8px 12px; border-radius:8px;
  background:var(--accent); border:none;
  font-size:13px; font-weight:600; color:#fff; cursor:pointer;
}
.cd-reply-btn-send:disabled { opacity:0.5; cursor:not-allowed; }
.cd-file-label { font-size:12px; color:var(--ink3); display:block; margin-top:6px; }
.cd-files-body { flex:1; overflow-y:auto; padding:14px 16px; -webkit-overflow-scrolling:touch; }
.cd-files-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:12px; }
.cd-file-card {
  background:var(--accent-l);
  border:1px solid rgba(29,92,58,0.2);
  border-radius:10px;
  overflow:hidden;
  cursor:pointer;
  text-decoration:none;
  color:inherit;
  display:block;
}
.cd-file-thumb {
  width:100%; aspect-ratio:4/3; object-fit:cover;
  display:block; background:var(--surface);
}
.cd-file-placeholder {
  width:100%; aspect-ratio:4/3;
  display:flex; align-items:center; justify-content:center;
  font-size:24px; background:var(--accent-l);
}
.cd-file-name {
  font-size:11px; font-weight:500; color:var(--accent);
  text-align:center; padding:6px 8px;
}
.cd-add-file-btn {
  border:2px dashed var(--border); border-radius:10px;
  padding:14px; display:flex; align-items:center;
  justify-content:center; gap:6px;
  cursor:pointer; font-size:13px; color:var(--ink3);
  font-weight:500; background:none; width:100%;
}

@media (min-width: 768px) {
  .cd-overlay {
    align-items:stretch;
    justify-content:flex-end;
  }
  .cd-sheet {
    width:clamp(520px, 44vw, 860px);
    max-width:none;
    height:100%;
    max-height:100%;
    border-radius:0;
    border-left:1px solid var(--border);
    box-shadow:-8px 0 32px rgba(0,0,0,0.1);
    transform:translateX(100%);
    transition:transform 0.28s cubic-bezier(0.4,0,0.2,1);
  }
  .cd-overlay.open .cd-sheet {
    transform:translateX(0);
  }
  .cd-handle { display:none; }
  .cd-header { padding:18px 24px 0; }
  .cd-header-title { font-size:17px; }
  .cd-tabs { padding:0 24px; margin-top:14px; }
  .cd-tab { font-size:14px; padding:10px 8px 9px; }
  #cd-tab-details,
  .cd-chat-scroll,
  .cd-files-body { padding:18px 24px; }
  .cd-reply-area { padding:14px 24px 24px; }
  .cd-meta-table {
    display:grid;
    grid-template-columns:1fr 1fr;
    column-gap:32px;
    row-gap:0;
  }
  .cd-meta-key { width:100px; }
  .cd-summary-box { font-size:14px; padding:12px 14px; }
  .cd-problem-box { font-size:15px; min-height:180px; max-height:min(58vh, 560px); }
  .cd-reply-input { min-height:100px; font-size:14px; }
  .cd-files-grid { grid-template-columns:repeat(3, 1fr); gap:10px; }
}

@media (min-width: 1200px) {
  .cd-sheet { width:clamp(640px, 46vw, 920px); }
  .cd-files-grid { grid-template-columns:repeat(4, 1fr); }
}

/* Modal */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.45); z-index:400; display:none; align-items:flex-end; justify-content:center; }
#archive-profile-modal { z-index:520; }
.archive-profile-summary {
  margin-bottom:14px;
  border-radius:var(--radius);
  background:linear-gradient(135deg, var(--accent-l) 0%, #f6faf7 52%, var(--white) 100%);
  border:1px solid rgba(29,92,58,0.16);
  box-shadow:0 1px 4px rgba(29,92,58,0.06);
  overflow:hidden;
  position:relative;
}
.archive-profile-summary::before {
  content:''; position:absolute; left:0; top:0; bottom:0; width:3px;
  background:linear-gradient(to bottom, var(--accent-m), var(--accent));
}
.archive-profile-summary-inner { padding:14px 16px 14px 18px; }
.archive-profile-summary-head {
  display:flex; align-items:center; gap:10px; margin-bottom:10px;
}
.archive-profile-summary-icon {
  width:32px; height:32px; border-radius:8px; flex-shrink:0;
  background:var(--accent); color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:15px; line-height:1;
  box-shadow:0 2px 8px rgba(29,92,58,0.22);
}
.archive-profile-summary-title {
  font-size:13px; font-weight:600; color:var(--ink); line-height:1.25;
}
.archive-profile-summary-sub {
  font-size:11px; color:var(--ink3); margin-top:1px;
}
.archive-profile-summary-body { padding-left:42px; }
.archive-profile-summary-text {
  font-size:13px; line-height:1.6; color:var(--ink2);
}
.archive-profile-summary-loading {
  display:flex; align-items:center; gap:8px;
  font-size:13px; color:var(--ink3);
}
.archive-profile-summary-spinner {
  width:14px; height:14px; flex-shrink:0;
  border:2px solid rgba(29,92,58,0.15);
  border-top-color:var(--accent);
  border-radius:50%;
  animation:archive-summary-spin 0.7s linear infinite;
}
@keyframes archive-summary-spin { to { transform:rotate(360deg); } }
/* Pull-to-refresh (PWA) */
#ptr-indicator {
  position:fixed; top:0; left:0; right:0; height:0; z-index:120;
  display:flex; align-items:flex-end; justify-content:center;
  overflow:hidden; pointer-events:none;
  opacity:0; visibility:hidden;
  background:linear-gradient(to bottom, rgba(255,255,255,0.98), rgba(255,255,255,0));
  padding:0 max(16px, var(--safe-right)) 0 max(16px, var(--safe-left));
  box-sizing:border-box;
  transition:height 0.18s ease, opacity 0.15s ease, visibility 0.15s ease;
}
#ptr-indicator.ptr-active {
  opacity:1; visibility:visible;
}
.ptr-inner {
  display:flex; align-items:center; gap:8px; color:var(--ink3); font-size:12px; white-space:nowrap;
  padding-top:var(--safe-top); padding-bottom:8px;
}
.ptr-spinner {
  width:18px; height:18px; border:2px solid var(--border); border-top-color:var(--accent);
  border-radius:50%; flex-shrink:0; transition:transform 0.15s ease;
}
#ptr-indicator.ptr-ready .ptr-spinner { transform:rotate(180deg); }
#ptr-indicator.ptr-spinning .ptr-spinner { animation:ptr-spin 0.7s linear infinite; }
@keyframes ptr-spin { to { transform:rotate(360deg); } }
body.pwa-standalone { overscroll-behavior-y:none; }


body.archive-profile-active #citizen-detail-modal,
body.archive-profile-active #appeal-detail,
body.archive-profile-active #archive-record-modal,
body.archive-profile-active #global-search-modal {
  visibility:hidden;
  pointer-events:none;
}
@media (max-width: 900px) { #social-list { grid-template-columns: repeat(2,1fr) !important; } }
@media (max-width: 600px) { #social-list { grid-template-columns: 1fr !important; } }
.modal-overlay.open { display:flex; }
.modal { background:var(--white); border-radius:16px 16px 0 0; padding:24px 20px 32px; width:100%; max-height:90vh; overflow-y:auto; }
@media (min-width:480px) { .modal { border-radius:16px; max-width:480px; padding:28px 28px 28px; } }
.modal h3 { font-size:17px; font-weight:500; margin-bottom:18px; }
.form-field { margin-bottom:14px; }
.form-field label { display:block; font-size:11px; font-weight:500; letter-spacing:0.04em; text-transform:uppercase; color:var(--ink3); margin-bottom:5px; }
.form-field input, .form-field textarea, .form-field select { width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); font-family:'Geologica',sans-serif; font-size:14px; color:var(--ink); outline:none; transition:all 0.2s; background:var(--white); }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color:var(--accent-m); box-shadow:0 0 0 3px rgba(29,92,58,0.1); }
.form-field textarea { resize:vertical; min-height:80px; line-height:1.6; }
.social-url-hint { font-size:11px; color:var(--ink3); margin-top:6px; line-height:1.4; }
.social-url-status { font-size:12px; margin-top:8px; line-height:1.45; padding:8px 10px; border-radius:var(--radius-sm); }
.social-url-status.loading { background:var(--surface); color:var(--ink2); border:1px solid var(--border); }
.social-url-status.ok { background:var(--accent-l); color:var(--ink); border:1px solid rgba(29,92,58,0.2); }
.social-url-status.warn { background:var(--warn-l); color:var(--ink); border:1px solid rgba(192,66,26,0.2); }
.social-url-status.err { background:#fff5f5; color:#8a2b2b; border:1px solid rgba(180,40,40,0.2); }
.social-attention-panel {
  background:linear-gradient(135deg, #fffaf6 0%, #fff 100%);
  border:1px solid rgba(192,66,26,0.25); border-radius:var(--radius);
  padding:14px 16px; margin-bottom:16px;
}
.social-attention-head { display:flex; align-items:center; gap:8px; margin-bottom:12px; font-size:14px; font-weight:500; color:var(--ink); flex-wrap:wrap; }
.social-attention-badge { font-size:11px; background:var(--warn); color:#fff; padding:2px 8px; border-radius:10px; font-weight:600; }
.social-suggestion-item {
  background:var(--white); border:1px solid var(--border); border-radius:var(--radius-sm);
  padding:12px 14px; margin-bottom:8px;
}
.social-suggestion-item:last-child { margin-bottom:0; }
.social-suggestion-score { font-size:11px; font-weight:600; color:var(--warn); background:var(--warn-l); padding:2px 8px; border-radius:8px; }
.social-suggestion-meta { font-size:11px; color:var(--ink3); margin-top:6px; line-height:1.45; }
.social-suggestion-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.modal-actions { display:flex; gap:10px; justify-content:flex-end; margin-top:20px; }

.empty-state { text-align:center; padding:48px 16px; color:var(--ink3); font-size:14px; line-height:1.6; }
.loading { text-align:center; padding:32px; color:var(--ink3); font-size:13px; }

/* Meeting schedule block */
.meeting-schedule-block { background:var(--surface); border-radius:var(--radius-sm); padding:12px; }
.meeting-schedule-row { display:flex; gap:10px; margin-bottom:10px; }
.meeting-schedule-row > div { flex:1; }
.meeting-schedule-label { font-size:11px; color:var(--ink3); margin-bottom:4px; text-transform:uppercase; letter-spacing:0.04em; }
.meeting-schedule-input { width:100%; padding:8px 10px; border:1px solid var(--border); border-radius:var(--radius-sm); font-family:'Geologica',sans-serif; font-size:13px; color:var(--ink); outline:none; background:var(--white); transition:border-color 0.2s; }
.meeting-schedule-input:focus { border-color:var(--accent-m); }

/* Global search */
.search-trigger-btn {
  display:flex; align-items:center; gap:8px;
  padding:6px 12px; border:1px solid var(--border); border-radius:var(--radius-sm);
  background:var(--surface); color:var(--ink3); font-family:'Geologica',sans-serif;
  font-size:12px; cursor:pointer; transition:all 0.2s; max-width:220px; flex:1;
}
.search-trigger-btn:hover { border-color:var(--accent-m); color:var(--ink2); background:var(--white); }
.search-trigger-btn svg { flex-shrink:0; opacity:0.7; }
.search-trigger-kbd { font-size:10px; padding:2px 6px; border:1px solid var(--border); border-radius:4px; background:var(--white); color:var(--ink3); white-space:nowrap; }
@media (max-width:640px) { .search-trigger-kbd { display:none; } .search-trigger-btn { max-width:36px; min-width:36px; padding:0; justify-content:center; flex-shrink:0; } .search-trigger-text { display:none; } .topbar-title { font-size:14px; } .topbar-actions { gap:6px; flex-shrink:0; } .create-trigger .hide-xs { display:none; } }
#global-search-modal { z-index:500; }
#global-search-modal .modal { max-width:720px; width:calc(100% - 24px); max-height:90vh; display:flex; flex-direction:column; padding:0; overflow:hidden; }
.gs-head { padding:16px 18px 12px; border-bottom:1px solid var(--border); }
.gs-input-wrap { display:flex; align-items:center; gap:10px; }
.gs-input-wrap input { flex:1; border:none; outline:none; font-family:'Geologica',sans-serif; font-size:16px; color:var(--ink); background:transparent; }
.gs-chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.gs-chip { padding:5px 11px; border-radius:20px; border:1px solid var(--border); background:var(--white); font-size:12px; color:var(--ink2); cursor:pointer; transition:all 0.15s; }
.gs-chip.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.gs-advanced { padding:12px 18px; border-bottom:1px solid var(--border); background:var(--surface); }
.gs-advanced-toggle { font-size:12px; color:var(--accent); cursor:pointer; background:none; border:none; font-family:'Geologica',sans-serif; padding:0; margin-bottom:8px; }
.gs-advanced-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
@media (max-width:560px) { .gs-advanced-grid { grid-template-columns:1fr; } }
.gs-advanced-grid label { display:block; font-size:10px; font-weight:500; text-transform:uppercase; letter-spacing:0.04em; color:var(--ink3); margin-bottom:4px; }
.gs-advanced-grid input, .gs-advanced-grid select { width:100%; padding:7px 10px; border:1px solid var(--border); border-radius:var(--radius-sm); font-family:'Geologica',sans-serif; font-size:13px; background:var(--white); }
.gs-body { flex:1; overflow-y:auto; padding:14px 18px 18px; }
.gs-meta { font-size:12px; color:var(--ink3); margin-bottom:10px; }
.gs-results { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
@media (max-width:640px) { .gs-results { grid-template-columns:1fr; } }
.gs-result { border:1px solid var(--border); border-radius:var(--radius-sm); padding:11px 12px; background:var(--white); cursor:pointer; transition:all 0.15s; }
.gs-result:hover { border-color:var(--accent-m); box-shadow:0 2px 8px rgba(0,0,0,0.04); }
.gs-result-top { display:flex; justify-content:space-between; gap:8px; align-items:flex-start; margin-bottom:6px; }
.gs-result-type { font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:0.05em; color:var(--ink3); }
.gs-result-title { font-size:13px; font-weight:500; color:var(--ink); line-height:1.35; margin-bottom:4px; }
.gs-result-sub { font-size:12px; color:var(--ink3); line-height:1.35; }
.gs-result-foot { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-top:8px; flex-wrap:wrap; }
.gs-empty { text-align:center; padding:32px 16px; color:var(--ink3); font-size:13px; }
/* Directories / activity log */
.ref-toolbar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:12px; }
.ref-date-input { padding:8px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); font-family:inherit; font-size:13px; background:var(--white); }
.ref-hint { font-size:12px; color:var(--ink3); margin:0 0 14px; line-height:1.5; }
.ref-hint code { font-size:11px; background:var(--surface); padding:1px 5px; border-radius:4px; }
.ref-form-card { background:var(--white); border:1px solid var(--border); border-radius:var(--radius); padding:16px; margin-bottom:16px; }
.ref-list-wrap { max-height:calc(100vh - 360px); overflow-y:auto; }
.activity-item { display:flex; gap:12px; padding:12px 14px; background:var(--white); border:1px solid var(--border); border-radius:var(--radius-sm); margin-bottom:8px; }
.activity-time { font-size:12px; color:var(--ink3); white-space:nowrap; min-width:44px; }
.activity-body { flex:1; min-width:0; }
.activity-user { font-size:13px; font-weight:500; margin-bottom:2px; }
.activity-action { font-size:13px; color:var(--ink2); line-height:1.45; }
.activity-meta { font-size:11px; color:var(--ink3); margin-top:4px; }
.email-template-card { background:var(--white); border:1px solid var(--border); border-radius:var(--radius); padding:16px; margin-bottom:16px; }
.email-template-card h3 { margin:0 0 6px; font-size:15px; }
.email-template-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }


/* Drug status block */
.drug-status { border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface); }
.drug-status-title { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink3); margin-bottom: 8px; }
.drug-status-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.drug-badge { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px; border: 1px solid transparent; }
.drug-badge-ok { background: #ecfdf3; color: #166534; border-color: #bbf7d0; }
.drug-badge-warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.drug-badge-bad { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.drug-status-meta, .drug-status-date, .drug-status-msg { font-size: 12px; color: var(--ink2); line-height: 1.5; }
.drug-status-success { border-color: #bbf7d0; background: #f8fff9; }
.drug-status-warn { border-color: #fde68a; background: #fffdf5; }
.drug-status-danger { border-color: #fecaca; background: #fffafa; }
.drug-status-neutral { border-color: var(--border); }

/* Med drug dashboard */
.med-dash-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; font-size: 12px; color: var(--ink2); }
.med-dash-filters label { display: inline-flex; align-items: center; gap: 6px; }
.med-dash-filters input, .med-dash-filters select { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: 'Geologica', sans-serif; font-size: 12px; }
.med-dash-kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (max-width: 900px) { .med-dash-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.med-dash-kpi { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.med-dash-kpi-val { font-size: 22px; font-weight: 600; color: var(--ink); }
.med-dash-kpi-label { font-size: 11px; color: var(--ink3); margin-top: 4px; line-height: 1.3; }
.med-dash-kpi-delta { font-size: 11px; color: var(--ink2); margin-top: 6px; }
.med-dash-kpi-sub { font-size: 11px; color: var(--warn); margin-top: 2px; }
.med-dash-panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.med-dash-panel-title { font-size: 12px; font-weight: 600; color: var(--ink2); margin-bottom: 10px; }
.med-dash-empty { font-size: 13px; color: var(--ink3); padding: 8px 0; }
.med-dash-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.med-dash-table th, .med-dash-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.med-dash-row { cursor: pointer; }
.med-dash-row:hover { background: var(--surface); }
.med-dash-chart { width: 100%; height: auto; }
.med-dash-chart-label { font-size: 9px; fill: var(--ink3); }
.med-dash-chart-legend { display: flex; gap: 16px; font-size: 11px; color: var(--ink3); margin-top: 6px; }
.med-dash-chart-legend .lg { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--accent); vertical-align: middle; margin-right: 4px; }
.med-dash-chart-legend .lg-nz { border-color: var(--warn); border-top-style: dashed; }
.med-dash-priority-block { margin-bottom: 10px; }
.med-dash-subtitle { font-size: 11px; font-weight: 600; color: var(--ink3); margin-bottom: 6px; }
.med-dash-priority-item { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }


/* Citizen appeal ZS / POS deadline badges */
.cd-deadline {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
  white-space: nowrap;
}
.cd-deadline-neutral { background: #f4f3f0; color: #6b6b73; }
.cd-deadline-warn { background: #fef7e5; color: #9a6200; }
.cd-deadline-danger { background: #fdf0eb; color: var(--warn); }

.ce-status-banner {
  font-size: 12px;
  font-weight: 500;
  color: #6b6b73;
  background: #f4f3f0;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.cal-week-event.pending {
  border-left-color: #9ca3af;
  background: rgba(107, 107, 115, 0.16);
  color: var(--ink2);
}
.cal-week-event.pending .cal-we-pending {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b6b73;
  margin-top: 2px;
}
.cal-dot.pending { background: #9ca3af; }
.dash-sched-item.pending { border-left-color: #9ca3af; background: #f4f3f0; }
.meeting-status.pending-review { background: #f4f3f0 !important; color: #6b6b73 !important; border: 1px solid #ddd; }

a.phone-link { color: var(--accent); text-decoration: none; font-weight: 500; }
a.phone-link:active { opacity: 0.75; }
@media (hover: hover) { a.phone-link:hover { text-decoration: underline; } }
