/* ============================================================================
   Office Suite - shared corporate theme.
   Loaded LAST by every app (landing, HRMS, Purchase and Account, PO & Billing,
   DC-Link). All apps use the same CSS variable names, so one file restyles the
   whole suite: navy sidebar, white cards, one blue accent, Inter type.
   To change the brand colour, edit the variables in :root below.
   ============================================================================ */

:root {
  --color-navy: #0b1f3a;
  --color-navy-2: #12305a;
  --color-primary: #1f55d4;
  --color-primary-dark: #1741a8;
  --color-primary-bg: #e8effd;
  --color-bg: #f2f5fa;
  --color-surface: #ffffff;
  --color-surface-alt: #f7f9fc;
  --color-border: #dbe3ee;
  --color-text: #0f1b2d;
  --color-text-muted: #55657d;
  --color-green: #12805c;
  --color-green-bg: #dff5ec;
  --color-orange: #b45f06;
  --color-orange-bg: #fdf0d5;
  --color-red: #c0392b;
  --color-red-bg: #fde7e4;
  --color-grey: #55657d;
  --color-grey-bg: #e6ebf3;
  --color-blue: #1f55d4;
  --color-blue-bg: #e8effd;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(11, 31, 58, 0.06);
  --shadow-md: 0 6px 20px rgba(11, 31, 58, 0.08);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-family: var(--font);
}

html, body { background: var(--color-bg); color: var(--color-text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { font-size: 14px; line-height: 1.5; }
h1, h2, h3 { letter-spacing: -0.01em; }

/* ---- Sidebar: deep navy ---- */
.sidebar {
  background: linear-gradient(180deg, var(--color-navy) 0%, #0d2646 100%);
  border-right: none;
  color: #cbd7ea;
}
.sidebar-brand { color: #fff; border-bottom: 1px solid rgba(255, 255, 255, 0.10); padding: 16px; }
.sidebar-brand small { color: #8fa4c4; }
.sidebar div.brand-mark { background: var(--color-primary); color: #fff; box-shadow: 0 4px 10px rgba(31, 85, 212, 0.45); }
.sidebar img.brand-mark { background: #fff; }
.sidebar-nav a, .sidebar-nav.grouped a, .sidebar nav a { color: #cbd7ea; border-radius: 9px; padding: 9px 12px; transition: background .15s, color .15s; }
.sidebar-nav a:hover, .sidebar-nav.grouped a:hover, .sidebar nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.sidebar-nav a.active, .sidebar-nav.grouped a.active, .sidebar nav a.active {
  background: var(--color-primary); color: #fff; font-weight: 600;
  box-shadow: 0 4px 12px rgba(31, 85, 212, 0.45);
}
.sidebar-group-head { color: #7f95b8; letter-spacing: 0.08em; font-weight: 600; }
.sidebar-group-head:hover { color: #fff; }
.sidebar-switch { background: rgba(255, 255, 255, 0.08); color: #e6eefc; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 9px; }
.sidebar-switch:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.sidebar-footer { border-top: 1px solid rgba(255, 255, 255, 0.10); color: #8fa4c4; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 8px; }

/* ---- Top bar ---- */
.topbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 0 rgba(11, 31, 58, 0.03);
}
.topbar h1 { font-size: 18px; font-weight: 700; color: var(--color-navy); }

/* ---- Cards & panels ---- */
.panel, .card, .stat-card, .quote-card, .login-card, .modal, .bell-dropdown, .hub-tile, .suite-choice-card, .module-card, .ticket {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  background: var(--color-surface);
}
.stat-card { border-left: 4px solid var(--color-primary); transition: transform .15s, box-shadow .15s; }
.stat-card:hover, .suite-choice-card:hover, .module-card:hover, .hub-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #c4d3ea; }
.panel-title, .section-title { color: var(--color-navy); font-weight: 700; }

/* ---- Buttons ---- */
button, .btn {
  border-radius: var(--radius-sm); font-family: var(--font); font-weight: 500;
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text);
  transition: background .15s, box-shadow .15s, border-color .15s;
}
button:hover { background: var(--color-surface-alt); border-color: #c4d3ea; }
button.primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; box-shadow: 0 2px 6px rgba(31, 85, 212, 0.30); }
button.primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
button.danger { background: #fff; color: var(--color-red); border-color: #f0c2bc; }
button.danger:hover { background: var(--color-red-bg); }

/* ---- Forms ---- */
input, select, textarea {
  font-family: var(--font); border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  background: #fff; color: var(--color-text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(31, 85, 212, 0.18); }
label, .field > label { color: var(--color-text-muted); font-weight: 600; font-size: 12px; }

/* ---- Tables ---- */
.table-wrap { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-sm); overflow-x: auto; }
table { font-size: 13px; }
thead th {
  background: #eef3fa; color: #3b4d68; font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; border-bottom: 1px solid var(--color-border);
}
tbody td { border-bottom: 1px solid #edf1f7; }
tbody tr:nth-child(even) td { background: #fafcff; }
tbody tr:hover td { background: var(--color-primary-bg); }

/* ---- Badges ---- */
.badge { border-radius: 999px; font-weight: 600; font-size: 11px; padding: 3px 10px; letter-spacing: 0.02em; }
.badge-green { background: var(--color-green-bg); color: var(--color-green); }
.badge-orange { background: var(--color-orange-bg); color: var(--color-orange); }
.badge-red { background: var(--color-red-bg); color: var(--color-red); }
.badge-blue { background: var(--color-blue-bg); color: var(--color-primary-dark); }
.badge-grey { background: var(--color-grey-bg); color: var(--color-grey); }

/* ---- Tabs ---- */
.tabs .tab, .subnav a { border-radius: 8px 8px 0 0; font-weight: 600; color: var(--color-text-muted); }
.tabs .tab.active, .subnav a.active { color: var(--color-primary); border-bottom: 2px solid var(--color-primary); }

/* ---- Modals / toasts ---- */
.modal-backdrop { background: rgba(11, 31, 58, 0.55); backdrop-filter: blur(2px); }
.modal-header { border-bottom: 1px solid var(--color-border); color: var(--color-navy); font-weight: 700; }
.toast { border-radius: 10px; box-shadow: var(--shadow-md); }

/* ---- Sign-in screen ---- */
.login-wrap, .login-wrap.suite { background: radial-gradient(1200px 600px at 20% -10%, #1d4a96 0%, transparent 60%), linear-gradient(160deg, var(--color-navy) 0%, #0d2a52 100%); }
.login-card { padding: 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); border: none; }
.login-card h1, .login-card h2 { color: var(--color-navy); }

/* ---- Workspace / suite picker ---- */
.workspace-hello { color: var(--color-navy); font-weight: 800; }
.workspace-sub { color: var(--color-text-muted); }
.suite-choice-card { padding: 22px; border-top: 4px solid var(--color-primary); }
.suite-choice-card.hrms { border-top-color: #1f55d4; }
.suite-choice-card.material { border-top-color: #0e7490; }
.suite-choice-card.dclink { border-top-color: #b45f06; }
.suite-choice-label { color: var(--color-navy); font-weight: 700; font-size: 17px; }
.role-badge { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; background: var(--color-primary-bg); color: var(--color-primary-dark); }
.role-badge.material { background: #def3f8; color: #0b5c71; }
.role-badge.dclink { background: var(--color-orange-bg); color: var(--color-orange); }
.workspace-body { max-width: 1040px; margin: 0 auto; }

/* ---- Small polish ---- */
a { color: var(--color-primary); }
::selection { background: rgba(31, 85, 212, 0.20); }
.empty-state { color: var(--color-text-muted); }

@media (max-width: 860px) {
  .topbar { padding: 10px 14px; }
  .topbar h1 { font-size: 16px; }
}

/* ---- Group hub pages (all apps) ---- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.hub-tile { display: block; padding: 18px; color: var(--color-text); text-decoration: none; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s, border-color .15s; }
.hub-tile .hub-icon { font-size: 26px; margin-bottom: 8px; }
.hub-tile .hub-label { font-weight: 700; font-size: 15px; color: var(--color-navy); }
.hub-tile .hub-desc { font-size: 12.5px; color: var(--color-text-muted); margin-top: 4px; }
.sidebar-group-label-link { color: inherit; text-decoration: none; }
.sidebar .sidebar-group-label-link:hover { color: #fff; }

/* ---- Link styled as a button + Common Master ---- */
a.button { display: inline-block; padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-primary-dark); font-weight: 600; text-decoration: none; }
a.button:hover { background: var(--color-primary-bg); }
.workspace-topbar #company-select { min-width: 170px; max-width: 240px; font-weight: 600; border-color: #b9c9e6; background: #fff; }
@media (max-width: 600px) { .workspace-topbar #company-select { min-width: 0; max-width: 100%; flex: 1 1 100%; order: -1; } }

/* ---- SitePilot tile + install/share row ---- */
.suite-choice-card.sitepilot { border-top-color: #0e9f6e; }
.role-badge.sitepilot { background: #dff5ec; color: #12805c; }
.workspace-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 22px; }

/* ============ One-window shell ============ */
html, body { height: 100%; }
.suite-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--color-bg); }
.shell-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--color-border); flex: none; flex-wrap: wrap; }
.shell-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.shell-controls .topbar-right { flex-wrap: wrap; }
.shell-tabs { display: flex; gap: 4px; padding: 6px 12px 0; background: var(--color-navy); overflow-x: auto; flex: none; -webkit-overflow-scrolling: touch; }
.shell-tab { display: flex; align-items: center; gap: 7px; padding: 9px 16px; border: none; border-radius: 10px 10px 0 0; background: transparent; color: #b6c6e3; font: 600 13px var(--font); cursor: pointer; white-space: nowrap; box-shadow: none; }
.shell-tab:hover { background: rgba(255,255,255,.08); color: #fff; }
.shell-tab.on { background: var(--color-bg); color: var(--color-navy); }
.shell-panes { flex: 1; position: relative; min-height: 0; }
.shell-pane { position: absolute; inset: 0; display: none; overflow: auto; }
.shell-pane.on { display: block; }
.shell-frame { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.shell-pane[data-pane="sitepilot"].on, .shell-pane[data-pane="dclink"].on, .shell-pane[data-pane="hrms"].on, .shell-pane[data-pane="po"].on { display: flex; flex-direction: column; overflow: hidden; }
.shell-pane .shell-frame { flex: 1; min-height: 0; }
.shell-extbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 14px; background: #fff7e0; border-bottom: 1px solid #f0dca0; font-size: 12.5px; color: #7a5a00; flex: none; flex-wrap: wrap; }
.shell-subbar { padding: 10px 16px 0; }
.home-admin { display: none; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
@media (max-width: 900px) {
  .shell-controls .topbar-admin-actions { display: none; }
  .home-admin { display: flex; }
  .shell-top { padding: 6px 10px; }
  .shell-controls .workspace-user > span:first-child { display: none; }
  .shell-tab { padding: 9px 12px; }
}
/* Combined notification dropdown */
.bell-combined { max-height: 70vh; overflow: auto; min-width: 330px; }
.bell-sec { font: 700 10.5px var(--font); letter-spacing: .07em; text-transform: uppercase; color: #7f8fa8; padding: 10px 12px 4px; }
.bell-foot { padding: 8px 12px 10px; font-size: 11.5px; border-top: 1px solid var(--color-border); }
.bell-item.unread { background: #e8effd; }
.bell-app-tag.src-dclink { background: #fdf0d5; color: #b45f06; }
.bell-app-tag.src-hrms { background: #e8effd; color: #1741a8; }
.bell-app-tag.src-po { background: #dff5ec; color: #12805c; }
.bell-app-tag.src-material { background: #def3f8; color: #0b5c71; }
@media (max-width: 600px) { .bell-combined { position: fixed; left: 8px; right: 8px; top: 60px; min-width: 0; } }
.shell-top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--color-navy); font-size: 16px; }
.shell-top .brand > *:first-child { width: 30px !important; height: 30px !important; max-width: 30px; border-radius: 8px; }
.shell-top .brand img, .shell-top .brand svg { width: 30px; height: 30px; }
/* Inside the one-window shell the company is chosen once, in the shell's top bar */
.in-suite-frame .topbar #company-select { display: none !important; }
.bell-app-tag.src-sitepilot { background: #dff5ec; color: #0e7a55; }

.shell-ext-card { max-width: 460px; margin: 8vh auto 0; padding: 26px 22px; text-align: center; background: var(--panel, #fff); border: 1px solid var(--line, #e3e7ee); border-radius: 14px; }
.shell-ext-ic { font-size: 40px; }
.shell-ext-card h2 { margin: 8px 0; }
.shell-ext-card p { color: var(--muted, #667); font-size: 13.5px; line-height: 1.5; margin: 0 0 16px; }
.shell-ext-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

webview.shell-frame { display: flex; }

/* ---- all apps on one screen (grid) with per-app maximise ---- */
.shell-cell-head { display: none; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px 4px 12px; background: var(--color-navy); color: #e8eefc; font: 600 12.5px var(--font); flex: none; cursor: default; }
.shell-cell-btn { border: none; background: rgba(255,255,255,.14); color: #fff; border-radius: 6px; width: 28px; height: 24px; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; box-shadow: none; }
.shell-cell-btn:hover { background: rgba(255,255,255,.3); }
.shell-panes.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 6px; padding: 6px; background: #d7dfec; }
.shell-panes.grid .shell-pane[data-pane="home"] { display: none !important; }
.shell-panes.grid .shell-pane.cell { position: relative; inset: auto; display: flex !important; flex-direction: column; overflow: hidden; min-height: 0; min-width: 0; border-radius: 10px; background: #fff; box-shadow: 0 1px 4px rgba(11,31,58,.18); }
.shell-panes.grid .shell-pane.cell .shell-cell-head { display: flex; }
.shell-panes.grid.has-max .shell-pane.cell { display: none !important; }
.shell-panes.grid.has-max .shell-pane.cell.max { display: flex !important; grid-column: 1 / -1; grid-row: 1 / -1; }
.shell-panes.grid.has-max { grid-template-rows: minmax(0, 1fr); }
.shell-ext-card { overflow: auto; }
@media (max-width: 800px) {
  .shell-panes.grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 78vh; overflow-y: auto; }
  .shell-panes.grid.has-max { grid-auto-rows: minmax(0, 1fr); overflow: hidden; }
}

.bell-click { cursor: pointer; }
.bell-click:hover { background: #eef3fa; }
.bell-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bell-readall { border: 1px solid var(--color-border); background: #fff; border-radius: 8px; padding: 4px 10px; font: 600 12px var(--font); color: #1f55d4; cursor: pointer; box-shadow: none; }
.bell-readall:disabled { opacity: .45; cursor: default; }

.bell-earlier { display: block; margin: 8px 12px 10px; }

/* ---- resizable grid: drag the bars between the windows ---- */
.shell-panes.grid { grid-template-columns: var(--gx, 50%) 10px minmax(0, 1fr); grid-template-rows: var(--gy, 50%) 10px minmax(0, 1fr); grid-auto-rows: auto; gap: 0; padding: 6px; }
.shell-panes.grid .shell-pane.cell[data-slot="0"] { grid-column: 1; grid-row: 1; }
.shell-panes.grid .shell-pane.cell[data-slot="1"] { grid-column: 3; grid-row: 1; }
.shell-panes.grid .shell-pane.cell[data-slot="2"] { grid-column: 1; grid-row: 3; }
.shell-panes.grid .shell-pane.cell[data-slot="3"] { grid-column: 3; grid-row: 3; }
.shell-panes.grid .shell-pane.cell.wide { grid-column: 1 / 4; }
.shell-gutter { display: none; background: transparent; position: relative; z-index: 6; touch-action: none; }
.shell-gutter::after { content: ""; position: absolute; background: #9fb0cc; border-radius: 3px; opacity: .55; transition: opacity .15s, background .15s; }
.shell-gutter-v { grid-column: 2; grid-row: 1 / 4; cursor: col-resize; }
.shell-gutter-v::after { left: 3px; right: 3px; top: 0; bottom: 0; }
.shell-gutter-h { grid-column: 1 / 4; grid-row: 2; cursor: row-resize; }
.shell-gutter-h::after { top: 3px; bottom: 3px; left: 0; right: 0; }
.shell-gutter-c { grid-column: 2; grid-row: 2; cursor: move; z-index: 7; }
.shell-gutter-c::after { inset: 0; border-radius: 50%; background: #1f55d4; }
.shell-gutter:hover::after, .shell-panes.dragging .shell-gutter::after { opacity: 1; background: #1f55d4; }
.shell-panes.grid:not(.has-max) .shell-gutter { display: block; }
.shell-panes.dragging { user-select: none; }
.shell-panes.dragging iframe, .shell-panes.dragging webview { pointer-events: none; }
.shell-cell-btns { display: flex; gap: 6px; }
.shell-panes.grid.has-max { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.shell-panes.grid.has-max .shell-pane.cell.max { grid-column: 1 / -1 !important; grid-row: 1 / -1 !important; }
@media (max-width: 800px) {
  .shell-panes.grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-rows: 78vh; }
  .shell-panes.grid .shell-pane.cell, .shell-panes.grid .shell-pane.cell.wide { grid-column: 1 !important; grid-row: auto !important; margin-bottom: 8px; }
  .shell-panes.grid .shell-gutter { display: none !important; }
  .shell-panes.grid.has-max { grid-auto-rows: minmax(0, 1fr); }
}

/* ---- remove / drag windows in the grid ---- */
.shell-cell-x:hover { background: #d64545; }
.shell-cell-head[draggable="true"] { cursor: grab; }
.shell-cell-head[draggable="true"]:active { cursor: grabbing; }
.shell-panes.dragging-cell iframe, .shell-panes.dragging-cell webview { pointer-events: none; }
.shell-panes.grid .shell-pane.cell.drop-target { outline: 3px dashed #1f55d4; outline-offset: -3px; }
.shell-gridbar { display: none; position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 30; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: 94%; padding: 7px 12px; background: #0b1f3a; color: #e8eefc; border-radius: 12px; box-shadow: 0 8px 26px rgba(11,31,58,.35); font: 600 12.5px var(--font); }
.shell-panes.grid .shell-gridbar:not(:empty) { display: flex; }
.shell-gridbar-b { border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.12); color: #fff; border-radius: 8px; padding: 4px 10px; font: 600 12px var(--font); cursor: pointer; box-shadow: none; }
.shell-gridbar-b:hover { background: rgba(255,255,255,.28); }
/* fewer windows -> bigger windows */
.shell-panes.grid[data-count="2"] { grid-template-rows: minmax(0, 1fr); }
.shell-panes.grid[data-count="2"] .shell-gutter-h, .shell-panes.grid[data-count="2"] .shell-gutter-c, .shell-panes.grid[data-count="1"] .shell-gutter, .shell-panes.grid[data-count="0"] .shell-gutter { display: none !important; }
.shell-panes.grid[data-count="2"] .shell-gutter-v { grid-row: 1; }
.shell-panes.grid[data-count="2"] .shell-pane.cell[data-slot="1"] { grid-column: 3; grid-row: 1; }
.shell-panes.grid[data-count="1"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.shell-panes.grid[data-count="1"] .shell-pane.cell[data-slot="0"] { grid-column: 1; grid-row: 1; }
@media (max-width: 800px) { .shell-panes.grid .shell-cell-head[draggable="true"] { cursor: default; } }

.shell-tab { position: relative; }
.shell-badge { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }

/* ---- app opened inside the common Settings (?embed=1): no sidebar / top bar of its own ---- */
html.suite-embed .sidebar, html.suite-embed .sidebar-backdrop, html.suite-embed .topbar, html.suite-embed .menu-toggle { display: none !important; }
html.suite-embed .main { margin-left: 0 !important; width: 100% !important; }
html.suite-embed .content, html.suite-embed .page { padding-top: 8px; }
html.suite-embed body { background: transparent; }

/* ---- common Settings screen ---- */
.settings-tabs, .settings-subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.settings-area .settings-body { padding: 0; }
.settings-frame-wrap { margin-top: 8px; }
.settings-frame { width: 100%; height: calc(100vh - 250px); min-height: 560px; border: 1px solid var(--border, #d9dfeb); border-radius: 10px; background: #fff; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.feat-item { display: flex; gap: 6px; align-items: center; font-weight: 400; }
.plain-list { margin: 6px 0 0 18px; line-height: 1.7; }
