/* =========================================================
   OfficeHub - per-module page styles
   ========================================================= */

/* ============ LOGIN ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #4a5a8f 55%, #26304d 100%); padding: 20px;
}
.login-card {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 400px; max-width: 100%; padding: 38px 36px 30px; text-align: center;
}
.login-logo { display: inline-flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 750; margin-bottom: 4px; }
.login-logo img { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; }
.login-card .login-sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.login-card .field { text-align: left; }
.login-err {
  background: var(--danger-soft); color: var(--danger); border-radius: 9px; padding: 10px 13px;
  font-size: 13px; margin-bottom: 14px; display: none;
}
.login-demo {
  margin-top: 18px; font-size: 12px; color: var(--muted); background: var(--surface-2);
  border-radius: 9px; padding: 9px; line-height: 1.6;
}
.login-demo b { color: var(--text); }

/* ============ DASHBOARD ============ */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.agenda-item { display: flex; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); align-items: center; }
.agenda-item:last-child { border-bottom: none; }
.agenda-item .when { width: 74px; flex: 0 0 auto; font-weight: 700; font-size: 12.5px; color: var(--primary); }
.agenda-item .when small { display: block; color: var(--muted); font-weight: 500; }
.agenda-item .what { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; }
.agenda-item .what small { display: block; font-weight: 400; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-row { padding: 12px 18px; border-bottom: 1px solid var(--border); }
.proj-row:last-child { border-bottom: none; }
.proj-row .flex { gap: 12px; }
.proj-row b { font-size: 13.5px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.quick-btn {
  border: 1px dashed var(--border-strong); border-radius: 12px; padding: 16px 10px; text-align: center;
  cursor: pointer; background: var(--surface); transition: .12s; font-size: 13px; font-weight: 600; color: var(--text);
}
.quick-btn:hover { border-color: var(--primary); background: var(--primary-softer); color: var(--primary); }
.quick-btn span { display: block; font-size: 24px; margin-bottom: 7px; }
.act-item { display: flex; gap: 11px; padding: 9px 18px; border-bottom: 1px solid var(--border); font-size: 13px; align-items: baseline; }
.act-item:last-child { border-bottom: none; }
.act-item .t { color: var(--muted); font-size: 11.5px; flex: 0 0 auto; width: 74px; }
.chart-box { position: relative; height: 240px; padding: 12px 16px 8px; }

/* ============ CALENDAR ============ */
.cal-toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-title { font-size: 16.5px; font-weight: 700; min-width: 180px; }
.view-switch { display: flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.view-switch button {
  border: none; background: var(--surface); padding: 7px 14px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; color: var(--muted); border-right: 1px solid var(--border);
}
.view-switch button:last-child { border-right: none; }
.view-switch button.on { background: var(--primary); color: #fff; }
.cal-legend { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

/* ---- HK holidays import modal ---- */
.holiday-year { border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px; margin-bottom: 10px; }
.holiday-year-h { display: flex; align-items: center; gap: 10px; }
.holiday-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; margin-top: 8px; }
.holiday-item { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.holiday-item span:last-child { word-break: keep-all; min-width: 0; }
.holiday-date { flex: 0 0 auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.holiday-item small.muted { color: var(--muted); }
#calendar { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
#calendar .fc { --fc-border-color: var(--border); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2);
  --fc-today-bg-color: rgba(var(--primary-rgb), .08); --fc-highlight-color: rgba(var(--primary-rgb), .14); font-size: 13px; }
#calendar .fc .fc-toolbar { display: none; }
#calendar .fc-theme-standard td, #calendar .fc-theme-standard th { border-color: var(--border); }
#calendar .fc .fc-daygrid-day-number, #calendar .fc .fc-col-header-cell-cushion { color: var(--text); padding: 5px 7px; }
#calendar .fc-event { border: none; cursor: pointer; font-size: 12px; }
#calendar .fc .fc-list-day-cushion { background: var(--surface-2); }
#calendar .fc .fc-list-event:hover td { background: var(--primary-softer); }
#calendar .fc .fc-scrollgrid { border-radius: 10px; }

/* ============ PROJECTS ============ */
.proj-layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.proj-list-panel .proj-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; margin-bottom: 10px;
  cursor: pointer; background: var(--surface); position: relative; overflow: hidden; transition: .12s;
}
.proj-list-panel .proj-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.proj-list-panel .proj-card.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.proj-card .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.proj-card h4 { font-size: 14px; margin-bottom: 2px; padding-right: 30px; }
.proj-card .meta { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.proj-card .proj-card-foot { display: flex; align-items: center; gap: 8px; }
.proj-card .progress { flex: 1; }
.proj-detail-head { border-left: 5px solid var(--primary); }
.status-pill { padding: 3px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.st-planning { background: #e8ecfd; color: #4a5cc7; }
.st-active { background: #dcf2fd; color: #0b74a3; }
.st-on_hold { background: #fdf3dd; color: #9a7a00; }
.st-completed { background: #e4f5e4; color: #12742f; }
.st-cancelled { background: #fde5e6; color: #c02637; }
html[data-theme="dark"] .st-planning { background: #2a2f4d; color: #9aa8f2; }
html[data-theme="dark"] .st-active { background: #12344a; color: #7cc7ee; }
html[data-theme="dark"] .st-on_hold { background: #433a17; color: #e0c368; }
html[data-theme="dark"] .st-completed { background: #1d3a22; color: #7fd68d; }
html[data-theme="dark"] .st-cancelled { background: #472124; color: #f198a0; }
.pr-1 { background: var(--ok-soft); color: var(--ok); }
.pr-2 { background: var(--warn-soft); color: var(--warn); }
.pr-3 { background: var(--danger-soft); color: var(--danger); }

/* ============ PLANNER (MS Project style) ============ */
.planner-wrap { display: flex; flex-direction: column; gap: 12px; }
.planner-toolbar { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.planner-toolbar .sep { width: 1px; height: 24px; background: var(--border-strong); margin: 0 3px; }
.planner-main { display: flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); min-height: 520px; }
.planner-table { width: 46%; min-width: 480px; flex: 0 0 auto; overflow: auto; max-height: 72vh; }
.planner-split {
  flex: 0 0 7px; cursor: col-resize; background: var(--border);
  transition: background .12s ease; z-index: 6;
}
.planner-split::after {
  content: ""; display: block; height: 26px; margin-top: 26px;
  border-left: 2px dotted var(--border-strong); border-radius: 2px;
}
.planner-split:hover, .planner-split.on { background: var(--primary); }
.planner-split:hover::after, .planner-split.on::after { border-color: #fff; }
.planner-gantt { flex: 1; overflow: auto; max-height: 72vh; background: var(--surface-2); position: relative; }
/* Sticky table header whose height is matched (via --pt-head-h, set from JS) to the
   Gantt's sticky timescale header, so every grid row sits exactly on its Gantt bar. */
.pt-head-wrap {
  position: sticky; top: 0; z-index: 5; background: var(--surface-2);
  display: flex; flex-direction: column; height: var(--pt-head-h, 85px);
  border-bottom: 1px solid var(--border);
}
.pt-head-cap {
  flex: 1; min-height: 0; display: flex; align-items: flex-end;
  padding: 4px 10px 6px; font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pt-head {
  display: grid;
  grid-template-columns: var(--pt-cols, 26px 42px minmax(220px,1fr) 56px 122px 122px 56px 84px 60px);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 700;
}
.pt-head > div { padding: 8px 7px; border-right: 1px solid var(--border); white-space: nowrap; position: relative; }
.pt-row {
  display: grid;
  grid-template-columns: var(--pt-cols, 26px 42px minmax(220px,1fr) 56px 122px 122px 56px 84px 60px);
  border-bottom: 1px solid var(--border); font-size: 12.5px; cursor: default; align-items: stretch;
  height: var(--pt-row-h, 36px);   /* must equal the Gantt's row pitch (bar_height + padding) */
  background: var(--pt-row-bg, transparent);
}
#ptRows { position: relative; padding-top: var(--pt-pad-top, 0px); }  /* first row lines up with the first bar band */
.pt-row:hover { background: var(--pt-row-bg, var(--primary-softer)); }
.pt-row.sel { background: var(--pt-row-bg, var(--primary-soft)); box-shadow: inset 0 0 0 2px var(--primary); }
.pt-row.crit { background: var(--pt-row-bg, rgba(209, 52, 56, .07)); }
.pt-row.sel.crit { background: var(--pt-row-bg, rgba(209, 52, 56, .16)); box-shadow: inset 0 0 0 2px var(--primary); }
.pt-row > div { padding: 5px 7px; border-right: 1px solid var(--border); display: flex; align-items: center; min-width: 0; overflow: hidden; }
.pt-row .cell-in {
  border: 1px solid transparent; background: transparent; font: inherit; color: inherit; width: 100%;
  padding: 2px 4px; border-radius: 5px; outline: none;
  height: min(26px, calc(var(--pt-row-h, 36px) - 8px));
}
.pt-row .cell-in:hover { border-color: var(--border-strong); }
.pt-row .cell-in:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 2px var(--primary-soft); }
.pt-wbs { color: var(--muted); font-size: 11.5px; font-family: var(--mono); }
.pt-name { font-weight: 600; }
.pt-row .pt-name .cell-in { font-weight: 600; }
.pt-ms { color: var(--danger); }
.pt-chip { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; margin-right: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }

/* ---- left corner icon (expand/collapse all) + row grip column ---- */
.pt-corner {
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--muted); font-size: 13px; padding: 0 !important; user-select: none;
}
.pt-corner:hover { color: var(--primary); background: var(--primary-softer); }
.pt-grip-cell { position: relative; justify-content: center; padding: 0 !important; }
.row-grip {
  color: var(--muted); font-size: 11px; letter-spacing: -1.5px; cursor: grab;
  user-select: none; line-height: 1; padding: 3px 4px; border-radius: 4px;
}
.pt-row:hover .row-grip { color: var(--primary); }
.row-grip:hover { color: var(--primary); background: var(--primary-soft); }
.pt-row.drag-src { opacity: .45; }
.rh-grip { position: absolute; left: 1px; right: 1px; bottom: 0; height: 8px; cursor: ns-resize; z-index: 2; }
.rh-grip::after {
  content: "≡"; position: absolute; left: 0; right: 0; bottom: 0;
  color: transparent; font-size: 9px; line-height: 8px; text-align: center;
}
.pt-row:hover .rh-grip::after { color: var(--muted); }
.rh-grip:hover::after { color: var(--primary); }

/* ---- summary collapse chevron in the grid ---- */
.pt-chev {
  width: 16px; flex: 0 0 auto; color: var(--muted); cursor: pointer; text-align: center;
  border-radius: 4px; font-size: 11px; line-height: 1;
}
.pt-chev:hover { color: var(--primary); background: var(--primary-soft); }

/* ---- column resize grips (header borders) ---- */
.col-grip {
  position: absolute; top: 20%; bottom: 20%; right: -4px; width: 8px;
  cursor: col-resize; z-index: 3; border-radius: 2px;
}
.col-grip:hover, body.pt-col-resizing .col-grip { background: var(--primary); }

/* ---- drag states + drop indicator ---- */
body.pt-col-resizing { cursor: col-resize; user-select: none; }
body.pt-ns-resizing { cursor: ns-resize; user-select: none; }
body.pt-row-dragging { cursor: grabbing; user-select: none; }
body.pt-row-dragging .pt-row:hover { background: var(--pt-row-bg, transparent); }
.pt-drop-ind {
  position: absolute; left: 0; right: 0; height: 0; z-index: 8; pointer-events: none;
  border-top: 3px solid var(--primary); border-radius: 2px;
}
.pt-drop-ind::before {
  content: ""; position: absolute; left: -1px; top: -6px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--primary);
}

/* custom row colours are usually light pastels - flip the text to dark in dark
   mode so task names, dates and inputs stay readable on the tinted rows */
html[data-theme="dark"] .pt-row[style*="--pt-row-bg"],
html[data-theme="dark"] .wbs-row[style*="--pt-row-bg"] { color: #1f2328; }
html[data-theme="dark"] .pt-row[style*="--pt-row-bg"] .cell-in,
html[data-theme="dark"] .pt-row[style*="--pt-row-bg"] .small,
html[data-theme="dark"] .pt-row[style*="--pt-row-bg"] .muted,
html[data-theme="dark"] .wbs-row[style*="--pt-row-bg"] .small,
html[data-theme="dark"] .wbs-row[style*="--pt-row-bg"] .muted { color: #1f2328; }
html[data-theme="dark"] .pt-row[style*="--pt-row-bg"] .cell-in::placeholder { color: #5b616e; }
html[data-theme="dark"] .pt-row[style*="--pt-row-bg"] .cell-in:focus { background: #fff; }

/* Trap frappe-gantt's internal z-indexes (1000/1001) inside its own stacking context,
   so the sticky month header can never paint over the topbar, modals, sidebar or toasts. */
.planner-gantt .gantt-container { isolation: isolate; }
/* (frappe-gantt's sticky .current-upper month label is neutralised from planner.js:
   it slides over the neighbouring month label when the chart is scrolled) */
.planner-gantt .upper-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* resize handles: show on hover so bar length can be dragged */
svg.gantt .handle { fill: var(--primary); opacity: 0; transition: opacity .15s ease; }
.planner-gantt .gantt .bar-wrapper:hover .handle { opacity: .95; }
.planner-gantt .gantt .handle { cursor: ew-resize; width: 7px; }
svg.gantt .handle.visible, svg.gantt .handle.active { opacity: 1 !important; }
svg.gantt .bar-wrapper.bar-summary .handle, svg.gantt .bar-wrapper.bar-ms .handle { display: none; }

/* ---- WBS / summary list ---- */
.wbs-list { display: flex; flex-direction: column; width: 100%; overflow: auto; max-height: 72vh; }
.wbs-tools { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; z-index: 5; }
.wbs-head, .wbs-row {
  display: grid; grid-template-columns: 52px minmax(220px,1.6fr) 96px 52px 92px 92px 128px 100px 64px;
}
.wbs-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 700; background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 45px; z-index: 4; }
.wbs-head > div { padding: 8px 8px; border-right: 1px solid var(--border); white-space: nowrap; }
.wbs-row { border-bottom: 1px solid var(--border); font-size: 12.5px; align-items: center; cursor: default; background: var(--pt-row-bg, transparent); }
.wbs-row > div { padding: 6px 8px; border-right: 1px solid var(--border); display: flex; align-items: center; min-width: 0; }
.wbs-row:hover { background: var(--pt-row-bg, var(--primary-softer)); }
.wbs-row.sel { background: var(--pt-row-bg, var(--primary-soft)); box-shadow: inset 0 0 0 2px var(--primary); }
.wbs-row.summary { background: var(--pt-row-bg, var(--surface-2)); font-weight: 700; }
.wbs-row.summary .wbs-label { font-weight: 700; }
.wbs-num { color: var(--muted); font-size: 11.5px; font-family: var(--mono); }
.wbs-num.crit { color: var(--danger); font-weight: 700; }
.wbs-chev { width: 18px; flex: 0 0 auto; color: var(--muted); cursor: pointer; text-align: center; border-radius: 4px; }
.wbs-chev:hover { color: var(--primary); background: var(--primary-soft); }
.wbs-chev.blank { cursor: default; }
.wbs-name { min-width: 0; }
.wbs-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wbs-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.wbs-badge.sum { background: var(--surface); color: var(--muted); border: 1px solid var(--border-strong); }
.wbs-badge.ms { background: var(--danger-soft); color: var(--danger); }
.wbs-prog { width: 64px; height: 7px; border-radius: 99px; background: var(--border); overflow: hidden; flex: 0 0 auto; margin-right: 7px; }
.wbs-prog + span { white-space: nowrap; }
.wbs-prog i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.wbs-row.summary .wbs-prog i { background: var(--muted); }

/* ---- font picker modal ---- */
.font-list { display: flex; flex-direction: column; gap: 6px; }
.font-list.compact { max-height: 170px; overflow-y: auto; padding-right: 3px; }
.font-opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 13px; border: 1px solid var(--border); background: var(--surface); border-radius: 9px; cursor: pointer; text-align: left; }
.font-opt:hover { border-color: var(--primary); background: var(--primary-softer); }
.font-opt.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.font-name { font-size: 13px; font-weight: 600; }
.font-sample { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }

/* planner text-style modal */
.style-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
  padding: 6px 13px; font-size: 12.5px; cursor: pointer; color: var(--text); line-height: 1.25;
}
.chip-btn:hover { border-color: var(--primary); background: var(--primary-softer); }
.chip-btn.on { border-color: var(--primary); background: var(--primary); color: #fff; }
.chip-btn.fw, .chip-btn.fi, .chip-btn.fu { min-width: 42px; text-align: center; }
.chip-btn.fw b, .chip-btn.fi i, .chip-btn.fu u { font-size: 14.5px; }
.text-preview {
  border: 1px dashed var(--border); border-radius: 9px; padding: 13px 16px;
  background: var(--surface-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: all .12s ease;
}

.gantt { user-select: none; }
svg.gantt .bar { fill: var(--primary) !important; }
svg.gantt .bar-progress { fill: rgba(255,255,255,.55) !important; }
svg.gantt .bar-label { fill: var(--text) !important; font-size: 11px; font-weight: 600; }
svg.gantt .bar-wrapper.bar-crit .bar { fill: #d13438 !important; }
svg.gantt .bar-wrapper.bar-crit .bar-label { fill: #d13438 !important; }
svg.gantt .bar-wrapper.bar-summary .bar { fill: #3a3f47 !important; }
svg.gantt .bar-wrapper.bar-summary .bar-progress { fill: rgba(255,255,255,.35) !important; }
svg.gantt .bar-wrapper.bar-summary .bar-label { font-weight: 700 !important; }
svg.gantt .bar-wrapper.bar-ms .bar { fill: #d13438 !important; width: 16px !important; height: 16px !important; transform: translateY(3px) rotate(45deg); transform-origin: center; transform-box: fill-box; }
svg.gantt .bar-wrapper.bar-ms .bar-progress { display: none !important; }
.gantt .bar-wrapper:hover { cursor: grab; }
/* frappe-gantt ships hardcoded light colours: re-map its CSS variables to the
   app theme so the chart header, ticks and text follow light/dark mode */
.planner-gantt .gantt-container {
  --g-header-background: var(--surface-2);
  --g-actions-background: var(--surface);
  --g-tick-color: var(--border);
  --g-tick-color-thick: var(--border-strong);
  --g-row-color: transparent;
  --g-row-border-color: var(--border);
  --g-text-dark: var(--text);
  --g-text-muted: var(--muted);
  --g-weekend-highlight-color: rgba(125, 130, 140, .06);
}
.planner-gantt .gantt-container .current-upper { background: var(--surface-2); }
.planner-gantt .gantt-container .popup-wrapper { background: var(--surface); box-shadow: 0 10px 24px -3px rgba(0,0,0,.3); }
.planner-gantt .gantt-container .popup-wrapper .title,
.planner-gantt .gantt-container .popup-wrapper .subtitle { color: var(--text); }
.planner-gantt .gantt-container .popup-wrapper .details { color: var(--muted); }
.planner-gantt .gantt-container .popup-wrapper .action-btn { background-color: var(--surface-2); }
html[data-theme="dark"] svg.gantt .bar-wrapper.bar-crit .bar-label { fill: #ff9a9d !important; }
html[data-theme="dark"] svg.gantt .bar-wrapper.bar-summary .bar { fill: #78808c !important; }
html[data-theme="dark"] svg.gantt .bar-wrapper.bar-summary .bar-label { fill: #c8cdd6 !important; }
svg.gantt .grid-header { fill: var(--surface-2) !important; stroke: var(--border); }
svg.gantt .grid-row { fill: transparent; }
svg.gantt .grid-row:nth-child(even) { fill: rgba(125,130,140,.05); }
svg.gantt .row-line { stroke: var(--border); }
svg.gantt .tick { stroke: var(--border-strong); }
svg.gantt .lower-text, svg.gantt .upper-text { fill: var(--muted) !important; font-size: 11px; }
svg.gantt .current-highlight { fill: rgba(var(--primary-rgb), .12); }
svg.gantt .date-range-highlight { fill: rgba(var(--primary-rgb), .08); }
svg.gantt .holiday-highlight { fill: rgba(125,130,140,.08); }
.gantt g.arrow path { stroke: #8a9099 !important; stroke-width: 1.4; fill: none !important; stroke-linecap: round; stroke-linejoin: round; }
.gantt g.arrow { pointer-events: none; }

/* ============ DIARY ============ */
.diary-item { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 13px; overflow: hidden; }
.diary-item .diary-head { display: flex; align-items: center; gap: 12px; padding: 12px 17px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.diary-item .diary-body { padding: 14px 17px; }
.diary-item .diary-body p { font-size: 13.5px; line-height: 1.65; }
.diary-facts { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.diary-atts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.diary-atts img { width: 74px; height: 74px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; }
.mp-row { display: flex; gap: 8px; margin-bottom: 7px; align-items: center; }
.mp-row .input.trade { flex: 2; } .mp-row .input.qty { flex: 1; }
.diary-print-page { max-width: 820px; margin: 0 auto; background: #fff; color: #111; padding: 40px 46px; }
.diary-print-page h1 { font-size: 20px; text-align: center; margin-bottom: 3px; }
.diary-print-page .print-sub { text-align: center; color: #555; margin-bottom: 22px; font-size: 12.5px; }
.print-kv { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.print-kv td { border: 1px solid #999; padding: 7px 10px; font-size: 13px; }
.print-kv td.k { background: #efefef; width: 130px; font-weight: 700; }
.print-sec { font-weight: 700; font-size: 13px; border-bottom: 2px solid #333; margin: 16px 0 8px; padding-bottom: 3px; }
.print-text { font-size: 13px; white-space: pre-wrap; line-height: 1.6; border: 1px solid #bbb; padding: 9px 12px; min-height: 40px; }

/* ============ ROUTINE TASKS ============ */
.task-group-title { font-size: 12px; font-weight: 750; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin: 18px 2px 9px; }
.task-group-title .badge { margin-left: 6px; }
.task-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px; border: 1px solid var(--border);
  border-radius: 11px; background: var(--surface); margin-bottom: 8px;
}
.task-row .task-main { flex: 1; min-width: 0; }
.task-row .task-main b { font-size: 13.5px; }
.task-row .task-main small { display: block; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row.late { border-left: 4px solid var(--danger); }
.task-row.done-today { opacity: .68; }
.task-row .done-btn {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border-strong); background: transparent;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: transparent; font-size: 14px; flex: 0 0 auto;
}
.task-row .done-btn:hover { border-color: var(--ok); color: var(--ok); }
.task-row .done-btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.freq-badge { font-size: 10.5px; font-weight: 800; padding: 2.5px 8px; border-radius: 6px; background: var(--surface-3); color: var(--muted); letter-spacing: .3px; }

/* ============ SNIPPETS ============ */
.snip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.snip-card { display: flex; flex-direction: column; }
.snip-card .card-b { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.snip-code {
  background: #0d1117; color: #e6edf3; border-radius: 9px; padding: 11px 13px; font-family: var(--mono);
  font-size: 12px; line-height: 1.55; white-space: pre; overflow: auto; max-height: 150px; position: relative;
}
.snip-tag { font-size: 11px; background: var(--surface-3); padding: 2px 9px; border-radius: 999px; color: var(--muted); }
.lang-badge { font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: 6px; letter-spacing: .4px; text-transform: uppercase; }

/* ============ GALLERY ============ */
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.gal-card { overflow: hidden; cursor: pointer; transition: .14s; }
.gal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.gal-thumb { height: 150px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gal-thumb .file-ico { font-size: 44px; }
.gal-meta { padding: 10px 13px; }
.gal-meta b { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gal-meta small { color: var(--muted); font-size: 11.5px; }
.lightbox { position: fixed; inset: 0; background: rgba(10, 12, 16, .88); z-index: 2100; display: flex; align-items: center; justify-content: center; padding: 30px; }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 10px; box-shadow: var(--shadow-lg); }
.lightbox .lb-bar { position: absolute; top: 16px; right: 20px; display: flex; gap: 8px; }
.lightbox .lb-meta { position: absolute; bottom: 18px; color: #fff; font-size: 13px; text-align: center; }

/* ============ WORDS COMPOSER ============ */
.words-layout { display: grid; grid-template-columns: 285px 1fr; gap: 16px; align-items: start; }
.doc-list-item {
  padding: 10px 13px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px;
  cursor: pointer; background: var(--surface);
}
.doc-list-item:hover { border-color: var(--border-strong); }
.doc-list-item.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.doc-list-item b { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-list-item small { color: var(--muted); font-size: 11px; }
.words-canvas { background: var(--surface-3); border: 1px solid var(--border); border-radius: 12px; padding: 26px 0; overflow: auto; max-height: calc(100vh - 220px); }
.word-page {
  width: 816px; min-height: 1056px; margin: 0 auto; background: #fff; color: #111;
  box-shadow: 0 3px 16px rgba(0,0,0,.16); padding: 0; border-radius: 2px;
}
.word-body { padding: 72px 84px; min-height: 980px; font-family: "Segoe UI", Calibri, sans-serif; font-size: 11pt; line-height: 1.5; outline: none; }
.word-body:focus { outline: none; }
.word-body table td, .word-body table th { border: 1px solid #999; padding: 6px; }
.word-body h1 { font-size: 22pt; } .word-body h2 { font-size: 16pt; }
.word-toolbar { background: var(--surface); border: 1px solid var(--border); border-radius: 12px 12px 0 0; }
.word-statusbar {
  display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 12px 12px; padding: 7px 16px; font-size: 12px; color: var(--muted);
}
.tox-tinymce { border: none !important; border-radius: 0 !important; }
.word-title-input {
  width: 100%; max-width: 816px; display: block; margin: 0 auto 12px; border: none; background: transparent;
  font-size: 21px; font-weight: 750; color: var(--text); padding: 6px 12px; outline: none; border-radius: 8px;
}
.word-title-input:hover, .word-title-input:focus { background: var(--primary-softer); }
.tox .tox-toolbar__primary { background: var(--surface-2) !important; }
.tox-tinymce--toolbar-sticky-on .tox-toolbar__primary { box-shadow: 0 1px 0 var(--border) !important; }
.tox .tox-edit-area__iframe { background: #fff !important; }
.zoom-wrap { transform-origin: top center; }

/* ============ EXCEL COMPOSER ============ */
.excel-layout { display: grid; grid-template-columns: 285px 1fr; gap: 16px; align-items: start; }
.excel-title-input {
  width: 100%; border: none; background: transparent; font-size: 18px; font-weight: 700;
  color: var(--text); padding: 7px 11px; outline: none; border-radius: 8px;
}
.excel-title-input:hover, .excel-title-input:focus { background: var(--primary-softer); }
#luckysheet { margin: 0; padding: 0; position: relative; }
.excel-shell { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
/* Luckysheet relies on content-box sizing everywhere */
.excel-shell #luckysheet, .excel-shell #luckysheet * { box-sizing: content-box; }
/* Luckysheet's internal toolbar also carries the class "toolbar": neutralise the app
   toolbar margin (it pushed the formula bar under the grid) and keep the icon row
   on ONE line with horizontal scrolling instead of wrapping + clipping. */
.excel-shell .luckysheet-wa-editor { margin-bottom: 0 !important; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.luckysheet-wrap { height: calc(100vh - 250px); min-height: 480px; }
html[data-theme="dark"] .luckysheet-wrap .sheet-list-panel { color: var(--text); }

/* ============ DOCUMENT MANAGER ============ */
.docs-layout { display: grid; grid-template-columns: 245px 1fr; gap: 16px; align-items: start; }
.docs-side .storage-box { padding: 13px 15px; font-size: 12px; color: var(--muted); }
.docs-tree { padding: 8px 10px; }
.tree-node { padding: 6px 9px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.tree-node:hover { background: var(--primary-softer); }
.tree-node.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tree-kids { margin-left: 17px; border-left: 1px dashed var(--border-strong); padding-left: 4px; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 13px; flex-wrap: wrap; }
.crumbs a { color: var(--primary); cursor: pointer; padding: 3px 7px; border-radius: 6px; }
.crumbs a:hover { background: var(--primary-softer); text-decoration: none; }
.crumbs .sep { color: var(--muted); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.file-tile {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 10px 11px; text-align: center;
  cursor: pointer; background: var(--surface); position: relative; transition: .12s;
}
.file-tile:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.file-tile.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.file-tile .ft-ico { font-size: 38px; line-height: 1.2; margin-bottom: 8px; }
.file-tile b { font-size: 12.5px; font-weight: 600; display: block; word-break: break-all; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.file-tile small { color: var(--muted); font-size: 10.5px; }
.file-tile img.thumb { width: 100%; height: 74px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }
.tile-actions { position: absolute; top: 6px; right: 6px; display: none; gap: 4px; }
.file-tile:hover .tile-actions { display: flex; }
.tile-actions .icon-btn { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.dropzone-active { outline: 3px dashed var(--primary); outline-offset: -10px; border-radius: 14px; background: var(--primary-softer); }
.preview-body { text-align: center; min-height: 200px; }
.preview-body img { max-width: 100%; max-height: 60vh; border-radius: 8px; }
.preview-body iframe { width: 100%; height: 62vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.preview-body pre { text-align: left; background: var(--surface-3); padding: 14px; border-radius: 9px; font-size: 12.5px; max-height: 60vh; overflow: auto; white-space: pre-wrap; }

/* ============ SETTINGS ============ */
.settings-layout { display: grid; grid-template-columns: 230px 1fr; gap: 18px; align-items: start; }
.settings-nav .snav-item {
  display: flex; gap: 10px; align-items: center; padding: 10px 13px; border-radius: 9px;
  cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 3px;
}
.settings-nav .snav-item:hover { background: var(--primary-softer); color: var(--text); }
.settings-nav .snav-item.on { background: var(--primary-soft); color: var(--primary); }
.theme-preview { border: 1px solid var(--border); border-radius: 12px; padding: 13px; display: flex; gap: 10px; align-items: center; }
.logo-up-box { border: 1px dashed var(--border-strong); border-radius: 11px; padding: 15px; text-align: center; }
.logo-up-box img { height: 44px; margin-bottom: 8px; }
.swatch-big { width: 40px; height: 40px; border-radius: 11px; cursor: pointer; border: 3px solid transparent; display: inline-block; }
.swatch-big.on { border-color: var(--text); }

/* ============ ADMINISTRATOR ============ */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.kv-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 12px 15px; }
.kv-item small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }
.kv-item b { font-size: 15.5px; }
.log-row { font-size: 13px; }

@media (max-width: 1100px) {
  .proj-layout, .words-layout, .excel-layout, .docs-layout, .settings-layout { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .planner-main { flex-direction: column; }
  .planner-table { width: 100%; min-width: 0; max-height: 46vh; border-right: none; border-bottom: 2px solid var(--border); }
  .planner-gantt { max-height: 52vh; }
  .wbs-head, .wbs-row { grid-template-columns: 44px minmax(160px,1.4fr) 88px 46px 86px 86px 110px 90px 56px; }
  .wbs-head { top: 43px; }
}
