/* ============================================================
   Younity Workspace — Design System
   Brand: #06111f dark · #071a33 sidebar · #244285 blue · #50A9C0 teal
   ============================================================ */

:root {
  --bg: #f6f9fc;
  --surface: #ffffff;
  --surface-2: #eef3f9;
  --surface-3: #e4ecf5;
  --border: #dce4ee;
  --border-strong: #c6d3e3;
  --text: #0c1c30;
  --text-muted: #5b6b80;
  --text-faint: #8496ab;

  --brand-dark: #06111f;
  --sidebar: #071a33;
  --sidebar-hover: #0f2b4d;
  --sidebar-active: #163a63;
  --brand-blue: #244285;
  --brand-blue-600: #1c3568;
  --teal: #50a9c0;
  --teal-dark: #3d8ba0;

  --danger: #d64545;
  --danger-bg: #fbe9e9;
  --warn: #cc8321;
  --warn-bg: #fbf1de;
  --success: #2e9e6b;
  --success-bg: #e4f4ec;
  --info: #6a5acd;
  --info-bg: #ece9fb;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(12, 28, 48, .06), 0 4px 16px rgba(12, 28, 48, .05);
  --shadow-lg: 0 12px 40px rgba(12, 28, 48, .18);
  --sidebar-w: 244px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.dark {
  --bg: #06111f;
  --surface: #0c1c30;
  --surface-2: #10263f;
  --surface-3: #163150;
  --border: #1c3350;
  --border-strong: #274669;
  --text: #e8eef6;
  --text-muted: #98abc4;
  --text-faint: #6f87a3;
  --danger-bg: #35201f;
  --warn-bg: #33291a;
  --success-bg: #16301f;
  --info-bg: #211d3a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
[hidden] { display: none !important; }

/* ---------- Brand mark ---------- */
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-blue), var(--teal));
  color: #fff; font-weight: 800; font-size: 20px;
  display: grid; place-items: center; flex: none;
  box-shadow: 0 4px 14px rgba(36, 66, 133, .35);
}
.brand-mark.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 15px; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-screen {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(80,169,192,.18), transparent),
    radial-gradient(1000px 600px at 110% 110%, rgba(36,66,133,.25), transparent),
    var(--brand-dark);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.brand-sub { color: var(--text-muted); font-size: 12.5px; }
.login-form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.field input, .field select, .field textarea {
  padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(36,66,133,.15);
}
.login-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 14px; color: var(--text-faint); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.login-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-chip {
  border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 9px 10px; text-align: left; color: var(--text); transition: .15s;
}
.role-chip:hover { border-color: var(--brand-blue); background: var(--surface-3); }
.role-chip b { display: block; font-size: 12.5px; }
.role-chip span { font-size: 11px; color: var(--text-muted); }
.login-note { text-align: center; color: var(--text-faint); font-size: 11.5px; margin-top: 18px; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100%; }

.sidebar {
  background: var(--sidebar); color: #cdd9ea; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.sidebar-brand-name { font-weight: 800; font-size: 16px; color: #fff; letter-spacing: -.01em; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6f88a8; padding: 14px 10px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px;
  color: #b7c6da; font-weight: 500; font-size: 13.5px; transition: .12s; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--teal); }
.nav-item .ni-icon { width: 18px; text-align: center; opacity: .9; font-size: 15px; }
.nav-item .ni-badge { margin-left: auto; background: rgba(255,255,255,.12); color: #dfeaf6; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.sidebar-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.theme-toggle {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 11px; border-radius: 9px;
  background: none; border: none; color: #b7c6da; font-size: 13px; font-weight: 500;
}
.theme-toggle:hover { background: var(--sidebar-hover); color: #fff; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 22px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.menu-btn { display: none; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 18px; display: grid; place-items: center; transition: .12s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.topbar-search { flex: 1; max-width: 460px; position: relative; }
.topbar-search input {
  width: 100%; padding: 10px 12px 10px 36px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text); outline: none;
}
.topbar-search input:focus { border-color: var(--brand-blue); background: var(--surface); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 17px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-user { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 6px 4px 4px; border-radius: 30px; }
.topbar-user:hover { background: var(--surface-2); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 12.5px; color: #fff; flex: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 46px; height: 46px; font-size: 16px; }
.tu-meta { line-height: 1.25; }
.tu-name { font-weight: 600; font-size: 13px; }
.tu-role { font-size: 11px; color: var(--text-muted); }

.view { padding: 26px 30px 60px; max-width: 1320px; width: 100%; }

/* ============================================================
   COMMON UI
   ============================================================ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.page-sub { color: var(--text-muted); font-size: 13.5px; margin-top: 3px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13px; transition: .12s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }
.btn-primary:hover { background: var(--brand-blue-600); }
.btn-teal { background: var(--teal); border-color: var(--teal); color: #05202a; }
.btn-teal:hover { background: var(--teal-dark); }
.btn-ghost { background: none; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 11px; font-size: 12px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14.5px; font-weight: 700; }
.card-head .link { color: var(--brand-blue); font-size: 12.5px; font-weight: 600; }

.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.two-pane { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }

/* Stat cards */
.stat { padding: 16px 18px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat-value { font-size: 27px; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; }
.stat-foot { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.stat-dot { width: 9px; height: 9px; border-radius: 50%; }
.trend-up { color: var(--success); } .trend-down { color: var(--danger); }

/* Badges & pills */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; line-height: 1.4;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.b-blue { background: rgba(36,66,133,.12); color: var(--brand-blue); }
.b-teal { background: rgba(80,169,192,.16); color: var(--teal-dark); }
.b-green { background: var(--success-bg); color: var(--success); }
.b-amber { background: var(--warn-bg); color: var(--warn); }
.b-red { background: var(--danger-bg); color: var(--danger); }
.b-violet { background: var(--info-bg); color: var(--info); }
.b-gray { background: var(--surface-3); color: var(--text-muted); }
body.dark .b-blue { background: rgba(80,140,220,.2); color: #93b7f2; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s; }
.table tbody tr.clickable:hover { background: var(--surface-2); cursor: pointer; }
.cell-strong { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--text-muted); }

/* client/person cell */
.person { display: flex; align-items: center; gap: 10px; }
.person .pmeta { line-height: 1.25; min-width: 0; }
.person .pname { font-weight: 600; }
.person .psub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Filter chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 7px 13px; border-radius: 20px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-muted); font-size: 12.5px; font-weight: 600; transition: .12s;
}
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }

/* Kanban board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: 290px; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.board-col { background: var(--surface-2); border-radius: var(--radius); border: 1px solid var(--border); display: flex; flex-direction: column; max-height: 74vh; }
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 700; font-size: 13px; position: sticky; top: 0; }
.board-col-head .count { margin-left: auto; color: var(--text-muted); font-size: 12px; background: var(--surface); padding: 1px 8px; border-radius: 12px; }
.board-col-body { padding: 0 10px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; }
.wi-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; box-shadow: var(--shadow); transition: .12s; cursor: pointer; }
.wi-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.wi-card .wi-svc { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.wi-card .wi-title { font-weight: 600; margin: 6px 0 4px; font-size: 13.5px; }
.wi-card .wi-client { font-size: 12px; color: var(--text-muted); }
.wi-card .wi-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; }
.wi-due { font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }

/* progress stepper */
.stepper { display: flex; align-items: center; gap: 0; margin: 6px 0; }
.step { display: flex; align-items: center; flex: 1; }
.step:last-child { flex: none; }
.step-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 2px solid var(--border-strong); background: var(--surface); color: var(--text-faint); flex: none; }
.step.done .step-dot { background: var(--success); border-color: var(--success); color: #fff; }
.step.current .step-dot { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }
.step-line { flex: 1; height: 2px; background: var(--border-strong); margin: 0 4px; }
.step.done .step-line { background: var(--success); }
.step-label { font-size: 10.5px; color: var(--text-muted); text-align: center; margin-top: 5px; }

/* Detail rows */
.detail-list { display: grid; gap: 0; }
.detail-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-row .dk { color: var(--text-muted); font-size: 12.5px; font-weight: 600; }
.detail-row .dv { font-size: 13.5px; }

/* Activity feed */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: none; }
.feed-body { font-size: 13px; }
.feed-time { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* Task list */
.task-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: none; }
.task-check { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; flex: none; cursor: pointer; color: transparent; font-size: 12px; }
.task-check.done { background: var(--success); border-color: var(--success); color: #fff; }
.task-row.done .task-title { text-decoration: line-through; color: var(--text-faint); }
.task-title { font-weight: 500; flex: 1; }

/* Calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; text-align: center; padding: 6px 0; }
.cal-cell { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; min-height: 92px; padding: 7px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell.dim { opacity: .45; }
.cal-cell.today { border-color: var(--brand-blue); box-shadow: inset 0 0 0 1px var(--brand-blue); }
.cal-date { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.cal-ev { font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }

/* Meters (workload) */
.meter { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand-blue), var(--teal)); }

/* Empty state */
.empty { text-align: center; padding: 46px 20px; color: var(--text-muted); }
.empty .em-ico { font-size: 34px; opacity: .4; }
.empty h4 { margin: 10px 0 4px; color: var(--text); }

/* Modal */
#modal-root:empty { display: none; }
.modal-overlay { position: fixed; inset: 0; background: rgba(6,17,31,.55); backdrop-filter: blur(2px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); max-height: 90vh; overflow-y: auto; animation: pop .16s; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px; display: grid; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-row { display: grid; gap: 6px; }
.form-row > label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--brand-dark); color: #fff; padding: 12px 20px; border-radius: 30px; font-size: 13px; font-weight: 600; z-index: 200; box-shadow: var(--shadow-lg); animation: pop .2s; }

.scrim { display: none; }

/* section title */
.sec-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin: 26px 0 12px; }

/* misc utilities */
.muted { color: var(--text-muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-muted); font-size: 11px; font-weight: 600; margin: 2px 3px 2px 0; }

/* ============================================================
   ICONS (inline SVG line icons)
   ============================================================ */
.icon { flex: none; vertical-align: -0.18em; }
.nav-item .ni-icon { display: inline-flex; align-items: center; justify-content: center; opacity: .85; }
.nav-item.active .ni-icon { opacity: 1; }
.search-icon { display: inline-flex; }
.wi-svc .icon, .btn .icon, .link .icon, .crumb .icon { vertical-align: -0.2em; }
.lock-ic { display: inline-flex; vertical-align: -0.18em; color: var(--danger); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; font-size: 0; }
.icon-btn.xs { width: 28px; height: 28px; border-radius: 7px; border-color: transparent; background: none; color: var(--text-faint); }
.icon-btn.xs:hover { background: var(--surface-2); color: var(--danger); }

/* select styled like a field (used inline in detail rows) */
.field-sel {
  padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font-weight: 600; outline: none;
}
.field-sel:focus { border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(36,66,133,.15); }

/* ============================================================
   FILE MANAGER (documents module)
   ============================================================ */
.fm-card { overflow: hidden; }
.fm { display: flex; min-height: 420px; }
.fm.has-rail { }

/* left rail */
.fm-rail { width: 210px; flex: none; border-right: 1px solid var(--border); background: var(--surface-2); padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; }
.fm-nav {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border-radius: 9px;
  border: none; background: none; color: var(--text-muted); font-size: 13px; font-weight: 600; text-align: left; transition: .12s;
}
.fm-nav:hover { background: var(--surface-3); color: var(--text); }
.fm-nav.active { background: var(--brand-blue); color: #fff; }
.fm-tree { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 2px 12px; }
.fm-tree-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; border-radius: 8px;
  border: none; background: none; color: var(--text-muted); font-size: 12.5px; font-weight: 500; text-align: left; transition: .12s;
}
.fm-tree-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-tree-item:hover { background: var(--surface-3); color: var(--text); }
.fm-tree-item.active { color: var(--brand-blue); font-weight: 700; }
.fm-rail-div { height: 1px; background: var(--border); margin: 10px 4px; }

/* main pane */
.fm-main { flex: 1; min-width: 0; padding: 18px 20px 22px; display: flex; flex-direction: column; }
.fm-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.fm-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.fm-crumbs { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; margin-top: 4px; }
.fm-crumb { border: none; background: none; color: var(--text-muted); font-size: 12.5px; font-weight: 600; padding: 2px 4px; border-radius: 6px; }
button.fm-crumb:hover { background: var(--surface-2); color: var(--text); }
.fm-crumb.active { color: var(--text); }
.fm-crumb-sep { color: var(--text-faint); display: inline-flex; }
.fm-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.fm-view-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 2px; margin-right: 2px; }
.fm-vt { border: none; background: none; padding: 6px 9px; border-radius: 7px; color: var(--text-faint); display: grid; place-items: center; }
.fm-vt:hover { color: var(--text); }
.fm-vt.active { background: var(--surface); color: var(--brand-blue); box-shadow: var(--shadow); }
body.dark .fm-vt.active { background: var(--surface-3); }

/* table */
.fm-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.fm-thead, .fm-row { display: grid; grid-template-columns: 1fr 120px 120px 76px; align-items: center; gap: 10px; padding: 11px 16px; }
.fm-thead { background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; }
.fm-row { border-bottom: 1px solid var(--border); transition: background .1s; }
.fm-row:last-child { border-bottom: none; }
.fm-row:hover { background: var(--surface-2); }
.fm-row.is-folder { cursor: pointer; }
.fm-cell-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fm-thumb { width: 38px; height: 38px; border-radius: 9px; background: rgba(36,66,133,.1); display: grid; place-items: center; flex: none; }
body.dark .fm-thumb { background: rgba(80,140,220,.14); }
.fm-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.fm-badge { font-size: 11px; color: var(--text-muted); }
.fm-cell-size, .fm-cell-mod { font-size: 12.5px; color: var(--text-muted); }
.fm-cell-act { display: flex; align-items: center; justify-content: flex-end; gap: 2px; opacity: 0; transition: .12s; }
.fm-row:hover .fm-cell-act { opacity: 1; }
.fm-act { width: 28px; height: 28px; border-radius: 7px; border: none; background: none; color: var(--text-faint); display: grid; place-items: center; transition: .12s; }
.fm-act:hover { background: var(--surface-3); color: var(--text); }
.fm-act.on { color: var(--warn); }
.fm-act.danger:hover { color: var(--danger); background: var(--danger-bg); }

/* grid */
.fm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.fm-tile { position: relative; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 18px 14px; text-align: center; transition: .12s; }
.fm-tile.is-folder { cursor: pointer; }
.fm-tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.fm-tile-ic { width: 54px; height: 54px; border-radius: 12px; background: rgba(36,66,133,.1); display: grid; place-items: center; margin: 0 auto 10px; }
body.dark .fm-tile-ic { background: rgba(80,140,220,.14); }
.fm-tile-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-tile-star { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 7px; border: none; background: none; color: var(--text-faint); display: grid; place-items: center; opacity: 0; transition: .12s; }
.fm-tile:hover .fm-tile-star, .fm-tile-star.on { opacity: 1; }
.fm-tile-star.on { color: var(--warn); }

.file-list { display: flex; flex-direction: column; }
.file-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 6px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--surface-2); }
.file-ic { color: var(--text-muted); display: inline-flex; flex: none; }
.file-meta { flex: 1; min-width: 0; }
.file-name { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.file-date { white-space: nowrap; min-width: 54px; text-align: right; }

/* ============================================================
   CALENDAR toolbar / ranges / agenda
   ============================================================ */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-period { font-weight: 700; font-size: 15px; margin-left: 6px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn { border: none; background: none; padding: 6px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
body.dark .seg-btn.active { background: var(--surface-3); }

.cal-cell-top { display: flex; align-items: center; justify-content: space-between; }
.cal-add {
  width: 20px; height: 20px; border-radius: 6px; border: none; background: none; color: var(--text-faint);
  display: grid; place-items: center; opacity: 0; transition: .12s;
}
.cal-cell:hover .cal-add { opacity: 1; }
.cal-add:hover { background: var(--surface-3); color: var(--brand-blue); }
.cal-grid.week { grid-template-columns: repeat(7, 1fr); }
.cal-cell.week { min-height: 220px; }

.agenda { display: flex; flex-direction: column; gap: 4px; }
.agenda-day { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.agenda-day:last-child { border-bottom: none; }
.agenda-date { font-weight: 700; font-size: 13px; color: var(--text-muted); padding-top: 8px; }
.agenda-items { display: flex; flex-direction: column; gap: 6px; }
.agenda-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; background: var(--surface-2); }
.agenda-item[data-goto] { cursor: pointer; }
.agenda-item[data-goto]:hover { background: var(--surface-3); }
.agenda-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.agenda-time { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 42px; }
.agenda-label { flex: 1; font-weight: 600; font-size: 13.5px; min-width: 0; }

/* ============================================================
   SERVICE EDITOR pickers
   ============================================================ */
.icon-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-opt {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-muted); display: grid; place-items: center; transition: .12s;
}
.icon-opt:hover { border-color: var(--brand-blue); color: var(--text); }
.icon-opt.active { border-color: var(--brand-blue); color: var(--brand-blue); background: rgba(36,66,133,.1); box-shadow: 0 0 0 2px rgba(36,66,133,.15); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--border); transition: .12s; }
.swatch.active { border-color: var(--surface); box-shadow: 0 0 0 2px var(--text); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .cols-4 { grid-template-columns: 1fr 1fr; }
  .cols-3 { grid-template-columns: 1fr 1fr; }
  .two-pane { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  :root { --sidebar-w: 0px; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(6,17,31,.5); z-index: 35; }
  .menu-btn { display: grid; }
  .view { padding: 18px 16px 50px; }
  .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .topbar-search { max-width: none; }
  .tu-meta { display: none; }
  .detail-row { grid-template-columns: 1fr; gap: 3px; }
  .page-title { font-size: 20px; }
  .agenda-day { grid-template-columns: 1fr; gap: 6px; }
  .agenda-date { padding-top: 0; }
  .cal-toolbar { align-items: flex-start; }
  .fm { flex-direction: column; }
  .fm-rail { width: auto; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); gap: 6px; }
  .fm-rail .fm-tree { display: none; }
  .fm-rail-div { display: none; }
  .fm-main { padding: 16px; }
  .fm-thead, .fm-row { grid-template-columns: 1fr auto; }
  .fm-cell-size, .fm-cell-mod { display: none; }
  .fm-cell-act { opacity: 1; }
}
