:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #1c2330;
  --muted: #6a7282;
  --primary: #1e4a72;
  --primary-hover: #163a5a;
  --primary-soft: #e8eff6;
  --accent: #c47a17;
  --success: #17794a;
  --success-soft: #e5f4ec;
  --warning: #a8590b;
  --warning-soft: #fdf1e2;
  --danger: #b3261e;
  --danger-soft: #fbe9e8;
  --info: #1e4a72;
  --info-soft: #e8eff6;
  --side-bg: #18212e;
  --side-text: #b9c2cf;
  --side-active: #ffffff;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --font: 'IBM Plex Sans Arabic', Tahoma, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
small { font-size: 12px; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--side-bg);
  color: var(--side-text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand img { width: 34px; height: 34px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; }
.nav { padding: 10px 0 24px; }
.nav a {
  display: block;
  padding: 8px 18px;
  color: var(--side-text);
  border-inline-start: 3px solid transparent;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .04); text-decoration: none; }
.nav a.active { color: var(--side-active); background: rgba(255, 255, 255, .07); border-inline-start-color: var(--accent); }
.nav-title {
  padding: 16px 18px 6px;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #7d8796;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title { font-size: 17px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-end { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.topbar-end a { color: var(--muted); }
.topbar-end a:hover { color: var(--text); }
.topbar-end .user-link { color: var(--text); font-weight: 500; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.menu-btn span { display: block; width: 20px; height: 2px; background: var(--text); margin: 4px 0; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.sidebar-backdrop { display: none; }

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.panel.no-pad { padding: 0; overflow-x: auto; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 14px;
}
.panel-head.pad { padding: 14px 18px 0; margin: 0 0 6px; }
.panel-head h3 { font-size: 15px; }
.panel-head:not(:first-child) { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.panel-head.pad:not(:first-child) { border-top: 0; }
.form-narrow { max-width: 720px; }
.form-wide { max-width: 1000px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-2 > .panel { margin-bottom: 0; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-inline-start: 3px solid var(--primary);
}
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 22px; font-weight: 600; margin-top: 2px; }
.stat-value small { color: var(--muted); font-weight: 400; }
.stat-sub { font-size: 12px; color: var(--muted); }
.text-warning { color: var(--warning) !important; }

/* Toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-end { display: flex; align-items: center; gap: 12px; }
.search { display: flex; gap: 8px; }
.search input { width: 260px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: #3c4554; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
.form-grid .span-2 { grid-column: span 2; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 7px 10px;
  min-height: 36px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30, 74, 114, .12); }
input:disabled { background: #f6f7f9; color: var(--muted); }
textarea { resize: vertical; }
.input-sm { width: 110px !important; min-height: 32px !important; padding: 4px 8px !important; }
.input-xs { width: 70px !important; min-height: 32px !important; padding: 4px 8px !important; }
.search select { width: 160px; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; margin: 4px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 18px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.logo-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo-preview { width: 80px; height: 80px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; background: #fff; }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.filters .field { margin-bottom: 0; }
.filters-actions { display: flex; gap: 8px; }
.inline-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; min-width: 220px; }
form.inline { display: inline; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 500;
  padding: 7px 16px;
  min-height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #f6f7f9; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-sm { min-height: 30px; padding: 3px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.danger, .link-btn.danger { color: var(--danger); }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); background: #f9fafb; white-space: nowrap; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact td, .table.compact th { padding: 8px 12px; }
.panel > .table.compact { margin: 0 -20px; width: calc(100% + 40px); }
.table .actions { white-space: nowrap; text-align: end; }
.table .actions > * + * { margin-inline-start: 12px; }
.start { text-align: start !important; }
.nowrap { white-space: nowrap; }
td.nowrap { direction: ltr; unicode-bidi: isolate; }
[dir=rtl] td.nowrap { text-align: right; }
.mono { font-family: Consolas, 'Courier New', monospace; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { text-align: center !important; color: var(--muted); padding: 28px !important; }
.panel.empty { padding: 40px; }

/* Badges / chips */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef0f3;
  color: #4b5563;
  white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #eef0f3; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 12px; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary); font-size: 13px; }
.chip-muted { background: #f0f1f3; color: var(--muted); }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: #c4e5d3; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f2c8c5; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #f4d9b5; }

/* Pager */
.pager { display: flex; gap: 6px; justify-content: center; margin: 6px 0 18px; }
.pager a { min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--text); }
.pager a.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager a:hover { text-decoration: none; border-color: var(--primary); }

/* Permissions */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.perm-group { margin: 0; display: flex; flex-direction: column; }
.perm-group legend { font-weight: 600; padding: 0 6px; }

/* Auth */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--side-bg); }
.auth-box { width: 100%; max-width: 380px; background: var(--surface); border-radius: 8px; padding: 30px 28px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.auth-box h2 { font-size: 20px; margin-bottom: 8px; }
.auth-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 3px solid var(--accent); }
.auth-head h2 { margin: 0; }
.auth-head .lang-switch { font-size: 13px; color: var(--muted); }
.auth-box .btn-block { margin-top: 6px; }

/* Responsive */
@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar {
    position: fixed;
    inset-inline-start: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  [dir=rtl] .sidebar { transform: translateX(100%); }
  .nav-open .sidebar { transform: none !important; }
  .nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; }
  .menu-btn { display: block; }
  .topbar { padding: 0 14px; }
  .topbar-end { gap: 10px; }
  .topbar-end .user-link { display: none; }
  .content { padding: 16px; }
  .form-grid, .filters { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .search, .search input { width: 100%; }
  .toolbar > * { width: 100%; }
  .toolbar-end { justify-content: space-between; }
}

/* Tabs */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tabs a span { font-size: 11px; background: #eef0f3; color: var(--muted); border-radius: 999px; padding: 1px 7px; margin-inline-start: 4px; }

/* Numbers */
.num, .table th.num, .table td.num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td.num, .table th.num { direction: ltr; unicode-bidi: isolate; }
[dir=rtl] .table td.num, [dir=rtl] .table th.num { text-align: left; }
.num-input { text-align: end; direction: ltr; font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
.text-danger { color: var(--danger) !important; }
.toolbar-start { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.action-bar { display: flex; gap: 10px; align-items: center; margin: 4px 0 18px; }
.danger-zone { margin: 8px 0 24px; }
.pre { white-space: pre-line; }

/* Record header */
.record-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.record-code { font-family: Consolas, monospace; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.record-sub { font-size: 13px; margin-top: 2px; }
.progress-box { min-width: 200px; }
.progress { height: 8px; background: #e6e9ee; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--success); }
.progress.sm { height: 5px; width: 80px; display: inline-block; vertical-align: middle; margin-inline-end: 6px; }

/* Definition lists */
.details { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 8px 14px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.details.cols-2 { grid-template-columns: 140px 1fr 140px 1fr; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* BOQ / claim tables */
.boq-table .desc, .claim-table .desc { white-space: pre-line; min-width: 260px; }
.col-no { width: 90px; white-space: nowrap; }
.col-unit { width: 100px; }
.col-num { width: 130px; }
.col-type { width: 90px; }
.col-act { width: 96px; white-space: nowrap; text-align: center !important; }
.section-row td { background: #f2f4f7; font-weight: 600; }
.subtotal-row td { background: #fafbfc; font-weight: 500; color: #3c4554; }
.total-row td { background: #eef2f6; font-weight: 700; }
.var-row td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
[dir=rtl] .var-row td:first-child { box-shadow: inset -3px 0 0 var(--accent); }
.changed { color: var(--accent); font-weight: 600; }
.over-qty td { background: var(--warning-soft) !important; }
.over-qty .f-cum { color: var(--danger); font-weight: 600; }

.boq-edit td { padding: 4px 6px; vertical-align: top; }
.boq-edit input, .boq-edit textarea, .boq-edit select, .claim-table input, #dedGrid input {
  min-height: 32px !important; padding: 4px 8px !important; border-color: #e6e9ee !important; background: #fff !important;
}
.boq-edit input:focus, .boq-edit textarea:focus, .boq-edit select:focus, .claim-table input:focus, #dedGrid input:focus {
  border-color: var(--primary) !important; background: #fff !important;
}
.boq-edit tbody tr:hover input, .boq-edit tbody tr:hover textarea, .boq-edit tbody tr:hover select, .claim-table tr:hover input { border-color: var(--border) !important; background: #fff !important; }
.claim-table input { border-color: var(--border) !important; background: #fff !important; }
.boq-edit textarea { resize: none; overflow: hidden; line-height: 1.5; }
.boq-edit .section-row textarea { font-weight: 600; }
.boq-edit .f-total { padding-top: 10px; }
.mini-btn { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; margin: 3px 1px; }
.mini-btn:hover { color: var(--text); border-color: var(--border-strong); }
.mini-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; margin-top: 0; z-index: 5; align-items: center; }

/* Claim summary */
.summary-table td:first-child { white-space: normal; }
.summary-table tr.deduct td:first-child { color: var(--muted); }
.net-due { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--primary-soft); }
.net-due strong { font-size: 20px; color: var(--primary); direction: ltr; unicode-bidi: isolate; }

@media (max-width: 760px) {
  .form-grid.cols-4, .details.cols-2 { grid-template-columns: 1fr 1fr; }
}
.nav-sep { height: 1px; background: rgba(255, 255, 255, .06); margin: 6px 18px; }
.claim-bottom { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.summary-table th, .summary-table td { padding: 8px 10px !important; }
@media (max-width: 900px) { .claim-bottom { grid-template-columns: 1fr; } }
.panel.no-pad > .table.compact { margin: 0; width: 100%; }
.record-code .badge { font-family: var(--font); }
.stat-value { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value small { font-size: 12px; }

/* Accounting */
.group-row td { font-weight: 600; background: #fafbfc; }
.row-muted td { color: var(--muted); }
.table th.center, .table td.center { text-align: center; }
.filters-6 { grid-template-columns: repeat(5, minmax(0, 1fr)) auto; }
input.invalid, select.invalid { border-color: var(--danger) !important; background: var(--danger-soft) !important; }
.amount-input { font-size: 18px !important; font-weight: 600; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.report-card { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); border-inline-start: 3px solid var(--primary); color: var(--text); }
.report-card:hover { text-decoration: none; border-color: var(--primary); }
.report-card span { color: var(--muted); font-size: 13px; }
@media (max-width: 1100px) { .filters-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-value { direction: ltr; text-align: left; }
[dir=rtl] .stat-value { text-align: right; }

/* Login: 25% form panel + brand image */
.login-page { margin: 0; min-height: 100vh; background: var(--side-bg); }
.login-split { display: flex; min-height: 100vh; }
.login-panel { flex: 0 0 25%; min-width: 340px; background: var(--surface); display: flex; align-items: center; justify-content: center; padding: 32px 28px; box-shadow: 0 0 30px rgba(0, 0, 0, .25); z-index: 1; }
.login-inner { width: 100%; max-width: 340px; }
.login-inner .btn-block { margin-top: 6px; }
.login-foot { margin-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }
.login-hero { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background-color: #141c28;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(135deg, #1b2738 0%, #121a26 100%);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px, 100% 100%; }
.login-hero.has-image { background-size: cover; background-position: center; background-repeat: no-repeat; }
.hero-content { text-align: center; color: #fff; padding: 40px; }
.hero-name { font-size: 56px; font-weight: 700; letter-spacing: .02em; line-height: 1.1; }
.hero-line { width: 90px; height: 4px; background: var(--accent); margin: 22px auto; }
.hero-tag { font-size: 18px; color: #b9c2cf; }
@media (max-width: 900px) {
  .login-split { flex-direction: column; }
  .login-hero { order: -1; flex: 0 0 180px; }
  .hero-name { font-size: 34px; }
  .hero-tag { font-size: 14px; }
  .login-panel { flex: 1; min-width: 0; box-shadow: none; }
}
.auth-title { font-size: 16px; margin: -6px 0 16px; }
.auth-alt { margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.label-row a { font-weight: 400; }
.hp-field { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; opacity: 0; }
.resend-box { margin: -6px 0 14px; }
.login-inner .check { margin: 2px 0 14px; }

/* Phase 5 */
.input-group { display: flex; gap: 6px; }
.input-group input { flex: 1; min-width: 0; }
.input-group select { width: auto; flex: 0 0 auto; }
.form-row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; width: 100%; }
.inline-form .form-row .field, .form-row .field { min-width: 130px; margin-bottom: 0; }
.inline-form .form-row .field.grow, .form-row .field.grow { flex: 1 1 200px; }
.inline-form .form-row .field.w-sm, .form-row .field.w-sm { min-width: 80px; width: 100px; flex: 0 0 100px; }
.att-grid { font-size: 12px; }
.att-grid th, .att-grid td { padding: 4px 3px; text-align: center; min-width: 22px; }
.att-grid td.name, .att-grid th.name { text-align: start; min-width: 160px; white-space: nowrap; position: sticky; inset-inline-start: 0; background: var(--surface); }
.att-grid .wkend { background: rgba(0,0,0,.035); }
.att-grid .p1 { color: var(--success); font-weight: 600; }
.att-grid .p05 { color: var(--warning); font-weight: 600; }
.log-section { margin-top: 6px; }
.log-section h3 { font-size: 15px; margin: 0 0 10px; }
.grid-table input, .grid-table select { width: 100%; }
.inline-new { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-new select, .inline-new input { width: auto; }
td.clip { max-width: 340px; }
.search input[type=date], .search input[type=month] { width: 160px; }
.grid-actions { padding: 10px 14px; border-top: 1px solid var(--border); }
.emp-cell { min-width: 190px; }
.search .check { white-space: nowrap; }
#payGrid input.num-input { min-width: 90px; }
.tender-grid .col-rate { width: 92px; }
.tender-grid td.f-description, .tender-grid .f-description { min-width: 220px; }
.tender-grid tr.is-section input, .tender-grid tr.is-section td { font-weight: 600; background: #f7f8fa; }
.cc-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; min-width: 80px; }
.cc-bar span { display: block; height: 100%; background: var(--primary); }
.cc-bar.over span { background: var(--danger); }
.cc-bar.warn span { background: var(--warning); }
.kpi-good { color: var(--success); }
.kpi-bad { color: var(--danger); }
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; align-items: start; }
.rep-grid .panel { margin-bottom: 0; }
.rep-list { list-style: none; margin: 0; padding: 0; }
.rep-list li { border-bottom: 1px solid var(--border); }
.rep-list li:last-child { border-bottom: 0; }
.rep-list a { display: block; padding: 9px 2px; color: var(--text); text-decoration: none; }
.rep-list a:hover { color: var(--primary); }
@media print {
  .sidebar, .topbar, .no-print, .tabs, .menu-btn { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; }
  .panel { box-shadow: none; border: 1px solid #ccc; }
}
a.stat-link { color: inherit; text-decoration: none; display: block; }
a.stat-link:hover { border-color: var(--primary); }
.field > span .quick-add { font-weight: 400; font-size: 12px; margin-inline-start: 10px; color: var(--primary); text-decoration: none; }
.field > span .quick-add:hover { text-decoration: underline; }
input.is-loading { background-image: linear-gradient(90deg, transparent, rgba(196,122,23,.12), transparent); background-size: 200% 100%; animation: trload 1s linear infinite; }
@keyframes trload { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.pad-form { padding: 4px 18px 16px; }
input[readonly] { background: #f6f7f9; color: #5a6270; }
/* Sidebar groups */
.nav-group { border-top: 1px solid rgba(255, 255, 255, .05); }
.nav-group-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 18px; background: none; border: 0; border-inline-start: 3px solid transparent; color: var(--side-text); font: inherit; cursor: pointer; text-align: start; }
.nav-group-btn:hover { color: #fff; background: rgba(255, 255, 255, .04); }
.nav-group.has-active > .nav-group-btn { color: #fff; }
.nav-group .chev { width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .15s; flex: none; opacity: .7; }
.nav-group.open .chev { transform: rotate(-135deg); }
.nav-group-items { display: none; padding-bottom: 6px; }
.nav-group.open .nav-group-items { display: block; }
.nav-group-items a { padding-inline-start: 34px; font-size: 13.5px; }
.nav > a + a, .nav > .nav-group + a { border-top: 1px solid rgba(255, 255, 255, .05); }
.nav > a { padding-top: 10px; padding-bottom: 10px; }

/* ===== Sidebar v2 ===== */
.sidebar { display: flex; flex-direction: column; background: linear-gradient(180deg, #1a2536 0%, #121a26 55%, #0e1520 100%); }
.sidebar-brand { gap: 12px; padding: 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.brand-mark { width: 38px; height: 38px; flex: none; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; color: #1a1205; background: linear-gradient(135deg, #f0b45a 0%, #c47a17 100%); box-shadow: 0 6px 16px rgba(196, 122, 23, .35); }
.sidebar-brand img { width: 38px; height: 38px; border-radius: 11px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.brand-text b { font-size: 14.5px; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { font-size: 11.5px; font-weight: 400; color: #8f9bab; }
.nav { flex: 1; padding: 12px 10px 18px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.nav > a, .nav-group-btn { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; margin: 2px 0; border-radius: 10px; border: 0; border-inline-start: 0; color: #c3ccd8; font: inherit; font-size: 14px; background: transparent; cursor: pointer; text-align: start; transition: background .15s, color .15s; }
.nav > a + a, .nav > .nav-group + a { border-top: 0; }
.nav > a:hover, .nav-group-btn:hover { background: rgba(255, 255, 255, .05); color: #fff; text-decoration: none; }
.nav > a.active { background: linear-gradient(90deg, rgba(196, 122, 23, .22), rgba(196, 122, 23, .08)); color: #fff; box-shadow: inset 0 0 0 1px rgba(240, 180, 90, .18); }
[dir=rtl] .nav > a.active { background: linear-gradient(270deg, rgba(196, 122, 23, .22), rgba(196, 122, 23, .08)); }
.nav > a.active .nav-ico { color: #f0b45a; }
.nav-ico { width: 19px; height: 19px; flex: none; color: #8693a5; transition: color .15s; }
.nav > a:hover .nav-ico, .nav-group-btn:hover .nav-ico { color: #dfe5ee; }
.nav > a span, .nav-group-btn span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group { border-top: 0; margin: 2px 0; border-radius: 12px; transition: background .2s; }
.nav-group.open { background: rgba(255, 255, 255, .025); }
.nav-group.has-active > .nav-group-btn { color: #fff; }
.nav-group.has-active > .nav-group-btn .nav-ico { color: #f0b45a; }
.nav-group .chev { width: 6px; height: 6px; opacity: .55; margin-inline-start: 4px; }
.nav-group-items { position: relative; padding: 2px 0 8px; margin-inline-start: 21px; }
.nav-group-items::before { content: ""; position: absolute; top: 2px; bottom: 10px; inset-inline-start: 0; width: 1px; background: rgba(255, 255, 255, .09); }
.nav-group-items a { position: relative; display: block; padding: 7px 14px; padding-inline-start: 18px; margin: 1px 0; margin-inline-end: 6px; border-radius: 8px; border: 0; font-size: 13.5px; color: #a9b4c2; }
.nav-group-items a::before { content: ""; position: absolute; inset-inline-start: -3px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #121a26; border: 1px solid rgba(255, 255, 255, .18); transition: all .15s; }
.nav-group-items a:hover { color: #fff; background: rgba(255, 255, 255, .04); text-decoration: none; }
.nav-group-items a.active { color: #fff; background: rgba(196, 122, 23, .14); }
.nav-group-items a.active::before { background: #f0b45a; border-color: #f0b45a; box-shadow: 0 0 0 3px rgba(240, 180, 90, .18); }
.nav-group-items a span { display: inline; }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin: 0 10px 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .05); }
.sidebar-user .avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #2f6f9f, #1e4a72); }
.sidebar-user .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sidebar-user b { font-size: 13px; color: #e8edf3; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { font-size: 11px; color: #8f9bab; }
.auth-forgot { text-align: center; margin-top: 14px; }
.auth-forgot a { color: var(--accent); font-weight: 500; }
/* Subscription plans */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; margin-bottom: 18px; }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(196, 122, 23, .12); }
.plan-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan-head h3 { font-size: 18px; margin: 0; }
.plan-price b { font-size: 26px; font-variant-numeric: tabular-nums; }
.plan-price b.contact { font-size: 17px; color: var(--muted); }
.plan-price span { color: var(--muted); font-size: 13px; }
.plan-limits, .plan-mods { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.plan-limits li { font-weight: 600; }
.plan-mods { flex: 1; padding-top: 12px; border-top: 1px solid var(--border); }
.plan-mods li { position: relative; padding-inline-start: 18px; color: var(--text); }
.plan-mods li::before { content: ""; position: absolute; inset-inline-start: 2px; top: 6px; width: 8px; height: 4px; border-left: 2px solid var(--success); border-bottom: 2px solid var(--success); transform: rotate(-45deg); }
.plan-form { display: flex; flex-direction: column; gap: 8px; }
.sub-pending { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-inline-start: 4px solid var(--warning); }
.req-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.req-actions input[type=date] { width: 150px; }
.req-actions input[name=reply] { flex: 1 1 140px; }
.row-btns { display: flex; gap: 6px; }
.nav-count { font-style: normal; font-size: 11px; font-weight: 700; background: #f0b45a; color: #1a1205; border-radius: 999px; padding: 1px 7px; }
.receipt-box .receipt-state { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.pay-info { border-inline-start: 4px solid var(--primary); }
.pay-info h3 { margin: 0 0 8px; font-size: 15px; }
.file-pick { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.file-pick input { font-size: 12.5px; }
.receipt-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.receipt-thumb:hover img { box-shadow: 0 0 0 2px var(--accent); }

/* platform revenue */
.stat-hero { background: linear-gradient(135deg, var(--primary, #1e4a72), #2c6a9c); color: #fff; border: 0; }
.stat-hero .stat-label, .stat-hero .stat-sub, .stat-hero .stat-value small { color: rgba(255,255,255,.8); }
.pkg-breakdown { display: flex; flex-wrap: wrap; gap: 10px; margin: -4px 0 18px; }
.pkg-chip { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; min-width: 170px; background: var(--surface, #fff); border: 1px solid var(--border, #e3e7ee); border-radius: 10px; color: inherit; text-decoration: none; font-size: 13px; }
.pkg-chip:hover { border-color: var(--primary, #1e4a72); }
.pkg-chip.active { border-color: var(--primary, #1e4a72); box-shadow: 0 0 0 2px rgba(30,74,114,.12); }
.pkg-chip span { color: var(--muted); font-size: 12px; }
.pkg-chip .pkg-mrr { color: var(--text, #1b2430); font-weight: 600; }
a.stat-hero { text-decoration: none; }

/* most popular plan */
.plan { position: relative; }
.plan.featured { border: 2px solid var(--accent); box-shadow: 0 12px 30px rgba(196, 122, 23, .18); transform: translateY(-6px); padding-top: 30px; }
.plan-ribbon { position: absolute; top: -13px; inset-inline-start: 50%; transform: translateX(50%); background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 600; padding: 4px 16px; border-radius: 999px; white-space: nowrap; box-shadow: 0 4px 10px rgba(196, 122, 23, .3); }
[dir="ltr"] .plan-ribbon { transform: translateX(-50%); }
.plans { padding-top: 18px; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(.95); color: #fff; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* subscription link in the sidebar */
.nav > a.nav-premium { position: relative; margin: 6px 0; color: #f6d79b; background: linear-gradient(100deg, rgba(240, 180, 90, .16), rgba(240, 180, 90, .04)); box-shadow: inset 0 0 0 1px rgba(240, 180, 90, .32); overflow: hidden; }
.nav > a.nav-premium .nav-ico { color: #f0b45a; filter: drop-shadow(0 0 4px rgba(240, 180, 90, .55)); animation: gem-glow 2.8s ease-in-out infinite; }
.nav > a.nav-premium::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; inset-inline-start: -60%; background: linear-gradient(90deg, transparent, rgba(255, 230, 180, .16), transparent); animation: gem-shine 4.5s ease-in-out infinite; pointer-events: none; }
.nav > a.nav-premium:hover, .nav > a.nav-premium.active { color: #fff; background: linear-gradient(100deg, rgba(240, 180, 90, .3), rgba(240, 180, 90, .1)); box-shadow: inset 0 0 0 1px rgba(240, 180, 90, .55); }
@keyframes gem-glow { 0%, 100% { filter: drop-shadow(0 0 2px rgba(240, 180, 90, .35)); } 50% { filter: drop-shadow(0 0 7px rgba(240, 180, 90, .85)); } }
@keyframes gem-shine { 0%, 60% { inset-inline-start: -60%; } 100% { inset-inline-start: 130%; } }
@media (prefers-reduced-motion: reduce) { .nav > a.nav-premium .nav-ico, .nav > a.nav-premium::after { animation: none; } }

/* WhatsApp support button on the login page */
.wa-btn { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; max-width: 380px; margin: 14px auto 0; padding: 11px 16px; border-radius: 10px; background: #25d366; color: #fff; font-weight: 600; font-size: 14.5px; text-decoration: none; box-shadow: 0 6px 18px rgba(37, 211, 102, .3); transition: background .15s, transform .15s; }
.wa-btn:hover { background: #1ebe5b; color: #fff; text-decoration: none; transform: translateY(-1px); }
.wa-btn svg { width: 22px; height: 22px; flex: none; }

/* product logo on auth pages */
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.auth-logo { max-height: 64px; max-width: 220px; object-fit: contain; }
.auth-head { align-items: flex-end; }
.logo-pick { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-pick img { height: 48px; max-width: 160px; object-fit: contain; background: #f4f6f9; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }

/* show / hide password */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 42px; }
.pw-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 6px; padding: 0; }
.pw-toggle:hover { color: var(--text); background: rgba(0, 0, 0, .05); }
.pw-toggle svg { width: 19px; height: 19px; }

/* branch count on plans */
.branch-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.branch-pick input { width: 90px; text-align: center; }
.plan-total { text-align: center; font-size: 13px; color: var(--muted); padding: 4px 0; }
.plan-total b { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }
.plan-limits li.plan-extra { font-weight: 400; color: var(--muted); }

/* ---------- branches ---------- */
.br-quota { font-size: 13px; padding: 5px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.br-quota.full { background: #fdf0dc; color: #8a5a10; }
.br-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.br-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.br-card:hover { border-color: var(--primary); text-decoration: none; transform: translateY(-1px); }
.br-card.inactive { opacity: .6; }
.br-card-head { display: flex; align-items: center; gap: 12px; }
.br-card-head > div { flex: 1; min-width: 0; }
.br-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.br-ico .nav-ico { color: var(--primary); width: 22px; height: 22px; }
.br-meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 13px; }
.br-meta dt { color: var(--muted); }
.br-meta dd { margin: 0; }

/* chat */
.chat-wrap { display: grid; grid-template-columns: 260px 1fr; height: calc(100vh - 150px); min-height: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.chat-side { border-inline-end: 1px solid var(--border); overflow-y: auto; background: #fafbfc; padding: 8px; }
.chat-ch { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text); text-decoration: none; }
.chat-ch:hover { background: var(--primary-soft); text-decoration: none; }
.chat-ch.active { background: var(--primary); color: #fff; }
.chat-av { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.chat-ch.active .chat-av { background: rgba(255,255,255,.2); color: #fff; }
.chat-ch-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 12px 18px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: baseline; }
.chat-stream { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, #f7f9fb, #fff); }
.chat-empty { margin: auto; }
.chat-msg { max-width: 72%; align-self: flex-start; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.chat-msg.mine { align-self: flex-end; background: var(--primary-soft); border-color: #cfdcea; }
.chat-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; }
.chat-meta b { color: var(--primary); }
.chat-meta time { margin-inline-start: auto; }
.chat-body { font-size: 14px; line-height: 1.6; word-wrap: break-word; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; min-height: 40px; max-height: 120px; }
.chat-as { width: auto; max-width: 160px; }
@media (max-width: 760px) {
  .chat-wrap { grid-template-columns: 1fr; height: auto; }
  .chat-side { display: flex; overflow-x: auto; border-inline-end: 0; border-bottom: 1px solid var(--border); }
  .chat-ch { flex: none; }
  .chat-stream { min-height: 50vh; }
}

/* internal mail */
.mail-list { overflow: hidden; }
.mail-row { display: grid; grid-template-columns: 220px 1fr auto; gap: 16px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.mail-row:hover { background: #f7f9fb; text-decoration: none; }
.mail-row.unread { background: #f4f8fc; }
.mail-row.unread .mail-from { font-weight: 700; }
.mail-row.unread .mail-from::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-inline-end: 7px; }
.mail-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-from small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.mail-subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mail-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mail-clip { font-style: normal; margin-inline-end: 6px; }
.mail-view h2 { margin: 0 0 12px; font-size: 20px; }
.mail-head { display: flex; flex-direction: column; gap: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.mail-rcpt { display: inline-block; padding: 1px 9px; border-radius: 999px; background: #fdf0dc; font-size: 12px; margin: 2px; }
.mail-rcpt.read { background: #e3f4e8; }
.mail-body { padding: 18px 0; line-height: 1.8; font-size: 15px; }
.mail-files { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fafbfc; font-size: 13px; }
.mail-quote { margin-top: 14px; padding: 10px 14px; border-inline-start: 3px solid var(--border-strong); background: #fafbfc; font-size: 13px; color: #4a5160; }
.check.strong { font-weight: 700; }
@media (max-width: 760px) { .mail-row { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- sales ---------- */
.input-btn { display: flex; gap: 6px; }
.input-btn input { flex: 1; min-width: 0; }
.doc-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 24px; margin: 0; }
.doc-meta dt { font-size: 12px; color: var(--muted); }
.doc-meta dd { margin: 2px 0 0; font-weight: 500; }
.doc-meta .span-2 { grid-column: span 2; }
.doc-totals { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding: 14px 18px; border-top: 1px solid var(--border); }
.doc-totals > div { display: flex; gap: 24px; min-width: 300px; justify-content: space-between; }
.doc-totals .grand { font-size: 18px; border-top: 2px solid var(--text); padding-top: 6px; margin-top: 4px; }
.grand-row td { font-size: 16px; }
.rbar { height: 8px; background: #eef1f5; border-radius: 99px; overflow: hidden; }
.rbar i { display: block; height: 100%; background: linear-gradient(90deg, #2c6a9c, #1e4a72); border-radius: 99px; }
.big-input { font-size: 22px !important; padding: 10px 12px !important; text-align: center; }
.big-val { font-size: 22px; }
.small-val { font-size: 15px !important; }
.shift-close h3 { margin-top: 0; }
.shift-diff { font-size: 16px; font-weight: 700; padding: 6px 0; min-height: 30px; }
.shift-diff.neg { color: var(--danger); }
.shift-diff.pos { color: #b26b00; }
.shift-diff.ok { color: var(--success); }
.return-find h3 { margin-top: 0; }
.print-frame { position: absolute; width: 0; height: 0; border: 0; visibility: hidden; }

/* point of sale */
.pos-mode .content { max-width: none; padding: 14px; }
.pos-open { max-width: 420px; margin: 40px auto; text-align: center; padding: 30px; }
.pos-open-ico { display: inline-flex; width: 64px; height: 64px; border-radius: 18px; background: var(--primary-soft); align-items: center; justify-content: center; }
.pos-open-ico .nav-ico { width: 34px; height: 34px; color: var(--primary); }
.pos-open .field { text-align: start; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 14px; height: calc(100vh - 92px); min-height: 520px; }
.pos-left, .pos-right { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.pos-bar { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.pos-search { flex: 1; position: relative; display: flex; align-items: center; }
.pos-search svg { position: absolute; inset-inline-start: 12px; width: 20px; height: 20px; color: var(--muted); }
.pos-search input { width: 100%; height: 46px; font-size: 16px; padding-inline: 42px 52px !important; border-radius: 10px; border: 2px solid var(--border); }
.pos-search input:focus { border-color: var(--primary); outline: 0; }
.pos-search kbd, .pos kbd, .pos-modal kbd { font-size: 10px; font-family: inherit; background: rgba(0,0,0,.08); border-radius: 4px; padding: 1px 5px; }
.pos-search kbd { position: absolute; inset-inline-end: 12px; }
.pos-bar select { width: auto; height: 46px; }
.pos-cats { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.pos-cats button { flex: none; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.pos-cats button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pos-grid { flex: 1; overflow-y: auto; padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-content: start; background: #f7f9fb; }
.pos-tile { display: flex; flex-direction: column; gap: 4px; text-align: start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; font: inherit; min-height: 96px; transition: border-color .12s, transform .12s, box-shadow .12s; }
.pos-tile:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(30,74,114,.12); transform: translateY(-1px); }
.pos-tile:active { transform: scale(.98); }
.pos-tile.low { opacity: .55; }
.pos-tile-name { font-weight: 600; font-size: 14px; line-height: 1.35; flex: 1; }
.pos-tile-code { font-size: 11px; color: var(--muted); direction: ltr; text-align: start; font-family: Consolas, monospace; }
.pos-tile-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.pos-tile-foot b { color: var(--primary); font-size: 15px; }
.pos-tile-foot small { color: var(--muted); font-size: 11px; }
.pos-none { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px; }
.pos-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: #fafbfc; }
.pos-head-actions { display: flex; gap: 6px; }
.pos-customer { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.pos-cust-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }
.pos-cust-info { min-height: 18px; margin-top: 4px; }
.pos-cart { flex: 1; overflow-y: auto; padding: 6px 10px; }
.pos-cart-empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.pos-line { display: grid; grid-template-columns: minmax(0, 1fr) 104px 76px 80px 24px; gap: 6px; align-items: center; padding: 8px 2px; border-bottom: 1px dashed var(--border); }
.pos-line-name { font-size: 13.5px; font-weight: 600; line-height: 1.3; overflow: hidden; }
.pos-line-name small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.pos-qty { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.pos-qty button { width: 28px; height: 32px; border: 0; background: #f2f4f7; font-size: 16px; cursor: pointer; }
.pos-qty input { width: 100%; min-width: 0; border: 0; text-align: center; height: 32px; padding: 0 2px; }
.pos-price { height: 32px; padding: 0 4px; text-align: center; }
.pos-line-total { text-align: end; font-size: 14px; direction: ltr; }
.pos-del { border: 0; background: none; color: var(--danger); font-size: 18px; cursor: pointer; padding: 0; }
.pos-totals { padding: 10px 14px; border-top: 1px solid var(--border); background: #fafbfc; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.pos-totals > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pos-disc > span:last-child { display: flex; gap: 4px; }
.pos-disc input { width: 90px; height: 30px; }
.pos-disc select { width: auto; height: 30px; padding: 0 6px; }
.pos-grand { font-size: 22px; font-weight: 700; color: var(--primary); border-top: 2px solid var(--border); padding-top: 6px; margin-top: 2px; }
.pos-pay { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 10px 12px 12px; }
.pos-pay-btn { height: 54px; font-size: 19px; font-weight: 700; }
.pos-pay-btn kbd { background: rgba(255,255,255,.2); color: #fff; }
.pos-modal { position: fixed; inset: 0; background: rgba(15,22,33,.55); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.pos-modal[hidden] { display: none; }
.pos-modal-box { width: 100%; max-width: 440px; background: #fff; border-radius: 16px; padding: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.3); display: flex; flex-direction: column; gap: 10px; }
.pos-modal-head { display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
.pos-modal-head .link-btn { font-size: 22px; }
.pay-total { text-align: center; padding: 10px; background: var(--primary-soft); border-radius: 12px; }
.pay-total span { display: block; font-size: 13px; color: var(--muted); }
.pay-total b { font-size: 32px; color: var(--primary); }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 6px; }
.pay-methods button { padding: 10px 6px; border: 2px solid var(--border); border-radius: 10px; background: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.pay-methods button.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.pay-input { font-size: 22px !important; height: 50px; text-align: center; }
.pay-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.pay-quick button { flex: 1; padding: 8px 4px; border: 1px solid var(--border); border-radius: 8px; background: #f7f9fb; font: inherit; cursor: pointer; direction: ltr; }
.pay-quick button:hover { border-color: var(--primary); }
.pay-change { text-align: center; font-size: 17px; min-height: 26px; }
.pos-confirm { height: 52px; font-size: 18px; font-weight: 700; }
.pos-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #127a3e; color: #fff; padding: 12px 22px; border-radius: 12px; font-weight: 600; z-index: 300; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.pos-toast.bad { background: var(--danger); }
@media (max-width: 1100px) { .pos { grid-template-columns: minmax(0, 1fr) 370px; } .pos-line { grid-template-columns: minmax(0, 1fr) 96px 70px 72px 22px; } }
@media (max-width: 860px) {
  .pos { grid-template-columns: 1fr; height: auto; }
  .pos-left { height: 55vh; }
  .pos-right { min-height: 70vh; }
}
@media print {
  .pos-mode .sidebar, .pos-mode .topbar { display: none; }
}
.nav-group-items a { display: flex; align-items: center; gap: 8px; }
.nav-group-items a span { flex: 1; min-width: 0; }
.nav-group-btn .nav-count { margin-inline-start: auto; }
[hidden] { display: none !important; }
/* centered brand: big logo with the product name under it */
.auth-head { position: relative; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-top: 26px; }
.auth-head .lang-switch { position: absolute; top: 0; inset-inline-end: 0; }
.auth-brand { align-items: center; gap: 12px; }
.auth-logo { max-height: 130px; max-width: 240px; width: auto; }
.auth-brand h2 { font-size: 22px; }
.auth-head:not(:has(.auth-logo)) { padding-top: 22px; }

/* ---------- workspaces ---------- */
.ws-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 12px 10px 0; padding: 4px; background: rgba(255,255,255,.06); border-radius: 12px; }
.ws-switch a { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; border-radius: 9px; color: #aeb8c6; font-size: 13px; font-weight: 600; text-decoration: none; transition: background .15s, color .15s; }
.ws-switch a .nav-ico { width: 17px; height: 17px; color: inherit; }
.ws-switch a:hover { color: #fff; text-decoration: none; }
.ws-switch a.active { background: linear-gradient(135deg, #f0b45a, #c47a17); color: #1a1205; box-shadow: 0 4px 12px rgba(196,122,23,.35); }
.portal { max-width: 980px; margin: 30px auto; }
.portal-hello { text-align: center; font-size: 18px; color: var(--muted); margin-bottom: 26px; }
.portal-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.portal-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 30px 28px; border-radius: 20px; color: #fff; text-decoration: none; overflow: hidden; min-height: 300px; box-shadow: 0 18px 40px rgba(16,24,40,.18); transition: transform .2s, box-shadow .2s; }
.portal-card:hover { transform: translateY(-4px); box-shadow: 0 24px 50px rgba(16,24,40,.25); text-decoration: none; color: #fff; }
.portal-card.ws-projects { background: linear-gradient(140deg, #1e4a72 0%, #12304d 100%); }
.portal-card.ws-branches { background: linear-gradient(140deg, #c47a17 0%, #8a4f06 100%); }
.portal-card::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.07); inset-inline-end: -80px; bottom: -110px; }
.portal-ico { width: 60px; height: 60px; border-radius: 16px; background: rgba(255,255,255,.15); display: inline-flex; align-items: center; justify-content: center; }
.portal-ico .nav-ico { width: 32px; height: 32px; color: #fff; }
.portal-card h2 { margin: 6px 0 0; font-size: 26px; color: #fff; }
.portal-card p { margin: 0; color: rgba(255,255,255,.8); line-height: 1.7; }
.portal-stats { display: flex; gap: 28px; margin-top: auto; padding-top: 10px; }
.portal-stats b { display: block; font-size: 24px; direction: ltr; text-align: start; }
.portal-stats span { font-size: 12px; color: rgba(255,255,255,.75); }
.portal-go { font-weight: 700; margin-top: 6px; }
[dir="ltr"] .portal-go { transform: scaleX(1); }
.br-today { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 14px; }
.br-today a { display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; color: inherit; text-decoration: none; }
.br-today a:hover { border-color: var(--primary); text-decoration: none; }
.br-today b { font-size: 20px; display: block; margin-top: 4px; }

/* ---------- branch attendance ---------- */
.seg { display: inline-flex; flex-wrap: nowrap; gap: 2px; padding: 3px; background: #f1f4f9; border: 1px solid var(--border); border-radius: 10px; }
.seg label { position: relative; cursor: pointer; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 5px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; transition: background .15s, color .15s; }
.seg label:hover span { color: var(--text); background: rgba(255,255,255,.7); }
.seg .seg-present input:checked + span { background: var(--success); color: #fff; box-shadow: 0 2px 6px rgba(23,121,74,.3); }
.seg .seg-absent input:checked + span { background: var(--danger); color: #fff; box-shadow: 0 2px 6px rgba(179,38,30,.3); }
.seg .seg-leave input:checked + span { background: #2f6fdb; color: #fff; box-shadow: 0 2px 6px rgba(47,111,219,.3); }
.seg .seg-off input:checked + span { background: #64748b; color: #fff; }
.seg input:disabled + span { cursor: default; }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
.batt-table input[type=time] { width: 120px; }
.batt-table tr[data-st="absent"] td:first-child { box-shadow: inset -3px 0 0 var(--danger); }
.batt-table tr[data-st="present"] td:first-child { box-shadow: inset -3px 0 0 var(--success); }
[dir=ltr] .batt-table tr[data-st="absent"] td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
[dir=ltr] .batt-table tr[data-st="present"] td:first-child { box-shadow: inset 3px 0 0 var(--success); }
.batt-table tr[data-st="absent"] .t-in, .batt-table tr[data-st="absent"] .t-out,
.batt-table tr[data-st="leave"] .t-in, .batt-table tr[data-st="leave"] .t-out,
.batt-table tr[data-st="off"] .t-in, .batt-table tr[data-st="off"] .t-out { opacity: .35; }
.t-late { color: var(--warning); font-weight: 600; }
.att-quick { display: flex; gap: 8px; }
.att-legend { margin: 0 0 10px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.att-grid .ab { color: var(--danger); font-weight: 700; }
.att-grid .lv { color: #2f6fdb; font-weight: 700; }
.att-grid th a { color: inherit; }
.table-wrap { overflow-x: auto; }

/* =====================================================================
   Modern theme (v16): softer surfaces, rounded cards, website-like feel
   ===================================================================== */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e6eaf1;
  --border-strong: #d5dbe5;
  --text: #0f1b2d;
  --muted: #6b7689;
  --primary: #1f5fd1;
  --primary-hover: #194eb0;
  --primary-soft: #eaf1fe;
  --info: #1f5fd1;
  --info-soft: #eaf1fe;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 4px 14px rgba(15, 27, 45, .05);
  --shadow-lg: 0 10px 30px rgba(15, 27, 45, .10);
  --ring: 0 0 0 4px rgba(31, 95, 209, .14);
}
body { background: var(--bg); -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 220px; background: radial-gradient(1200px 220px at 50% -40px, rgba(31, 95, 209, .08), transparent 70%); pointer-events: none; z-index: 0; }
.main { position: relative; z-index: 1; }
::selection { background: rgba(31, 95, 209, .18); }

/* top bar: glassy, taller, bold title */
.topbar { height: 66px; padding: 0 28px; background: rgba(255, 255, 255, .78); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid rgba(15, 27, 45, .06); }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.topbar-end { gap: 8px; }
.topbar-end a { padding: 7px 12px; border-radius: 999px; transition: background .15s, color .15s; }
.topbar-end a:hover { background: #eef2f8; color: var(--text); text-decoration: none; }
.topbar-end .lang-switch { border: 1px solid var(--border); background: #fff; font-weight: 600; }
.topbar-end .user-link { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); font-weight: 600; }
.topbar-end .user-link::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.topbar-end .logout { color: var(--danger); }
.topbar-end .logout:hover { background: var(--danger-soft); color: var(--danger); }
.content { padding: 28px; }

/* cards */
.panel { border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 22px; }
.panel.no-pad { overflow: hidden; overflow-x: auto; }
.panel-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -.005em; }
.panel-head.pad { padding: 18px 22px 4px; }
.panel-head .link, .panel-head > a:not(.btn) { font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.panel-head .link:hover, .panel-head > a:not(.btn):hover { text-decoration: none; background: #dbe7fd; }
.grid-2 { gap: 22px; }

/* KPI cards */
.stats { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat { position: relative; overflow: hidden; border: 1px solid var(--border); border-inline-start: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--primary), #5b8def); }
.stat:nth-child(4n+2)::before { background: linear-gradient(90deg, #12a46b, #4fd39b); }
.stat:nth-child(4n+3)::before { background: linear-gradient(90deg, #e0911f, #f6c26b); }
.stat:nth-child(4n+4)::before { background: linear-gradient(90deg, #7c4ddb, #a98af0); }
.stat::after { content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%; background: var(--primary-soft); opacity: .55; inset-inline-end: -40px; bottom: -60px; }
.stat > * { position: relative; z-index: 1; }
.stat-label { font-size: 13px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
a.stat { color: inherit; text-decoration: none; display: block; }

/* inputs */
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { min-height: 40px; padding: 8px 12px; border-radius: var(--radius); border-color: var(--border-strong); background-color: #fff; transition: border-color .15s, box-shadow .15s; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):hover, select:hover, textarea:hover { border-color: #b9c3d3; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--ring); }
.field > span { font-size: 13px; font-weight: 600; color: #34405a; }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: #f5f7fa; }
.search input { border-radius: 999px; padding-inline-start: 16px; }

/* buttons */
.btn { min-height: 40px; padding: 8px 18px; border-radius: var(--radius); font-weight: 600; border-color: var(--border); background: #fff; box-shadow: 0 1px 2px rgba(15, 27, 45, .05); transition: background .15s, box-shadow .15s, transform .12s, border-color .15s; }
.btn:hover { background: #f6f8fc; border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, #2b6de0, #1f5fd1); border-color: #1d58c4; color: #fff; box-shadow: 0 4px 12px rgba(31, 95, 209, .28), inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn-primary:hover { background: linear-gradient(180deg, #2462d4, #194eb0); border-color: #194eb0; box-shadow: 0 6px 16px rgba(31, 95, 209, .34); }
.btn-sm { min-height: 32px; padding: 4px 13px; font-size: 13px; border-radius: 8px; }
.link-btn { font-weight: 600; }

/* tables */
.table th, .table td { padding: 12px 16px; border-bottom-color: #eef1f6; }
.table th { font-size: 12px; font-weight: 700; color: #5d6a80; background: #f8fafd; letter-spacing: .01em; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f7faff; }
.table .actions a, .table .actions .link-btn { font-weight: 600; }
.panel.no-pad > .table thead th:first-child, .panel.no-pad > .table-wrap > .table thead th:first-child { border-start-start-radius: var(--radius-lg); }
.panel.no-pad > .table thead th:last-child { border-start-end-radius: var(--radius-lg); }

/* badges & chips */
.badge { font-size: 11.5px; font-weight: 600; padding: 3px 10px; }
.chip { border-radius: 999px; font-weight: 500; }

/* alerts */
.alert { position: relative; padding: 12px 16px; padding-inline-start: 44px; border-radius: 12px; border: 1px solid transparent; font-weight: 500; box-shadow: 0 1px 2px rgba(15, 27, 45, .04); }
.alert::before { content: "i"; position: absolute; inset-inline-start: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #1f5fd1; }
.alert-success::before { background: var(--success); }
.alert-error::before { background: var(--danger); }
.alert-warning::before { background: #d98a1c; }
.alert::after { content: "i"; position: absolute; inset-inline-start: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; font-family: Georgia, serif; }
.alert-success::after { content: "✓"; font-family: inherit; }
.alert-error::after, .alert-warning::after { content: "!"; font-family: inherit; }
.alert-info { background: var(--info-soft); color: #1a4fae; border-color: #cddcfb; }
.alert-success { border-color: #bfe6d0; }

/* tabs: pill style */
.tabs { box-shadow: none; gap: 6px; padding: 5px; background: #fff; border: 1px solid var(--border); border-radius: 14px; width: fit-content; max-width: 100%; margin-bottom: 18px; box-shadow: var(--shadow); }
.tabs a { padding: 8px 16px; border-bottom: 0; border-radius: 10px; font-weight: 600; transition: background .15s, color .15s; }
.tabs a:hover { background: #f3f6fb; }
.tabs a.active { color: #fff; background: var(--primary); box-shadow: 0 3px 10px rgba(31, 95, 209, .28); }
.tabs a.active span { background: rgba(255, 255, 255, .22); color: #fff; }

/* pager */
.pager a { border-radius: 10px; font-weight: 600; }
.pager a.current { box-shadow: 0 3px 10px rgba(31, 95, 209, .28); }

/* toolbar */
.toolbar { margin-bottom: 18px; }
.form-actions { border-top-color: #eef1f6; }
.sticky-actions { background: linear-gradient(180deg, rgba(244, 246, 251, 0), var(--bg) 35%); padding-top: 18px; }

/* report / branch cards */
.report-card { border-radius: var(--radius-lg); border-inline-start: 1px solid var(--border); box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s; }
.report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #c9d8f6; }
.br-today a { border-radius: 14px; box-shadow: var(--shadow); background: #fff; transition: transform .18s, box-shadow .18s; }
.br-today a:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* sidebar accents follow the new primary */
.sidebar-user .avatar { background: linear-gradient(135deg, #3b7bea, #1f5fd1); }
.portal-card.ws-projects { background: linear-gradient(140deg, #2b6de0 0%, #173f8f 100%); }

@media (max-width: 760px) {
  .topbar { padding: 0 14px; height: 60px; }
  .page-title { font-size: 17px; }
  .content { padding: 16px; }
  .panel { padding: 18px; border-radius: 14px; }
  .tabs { width: 100%; }
  .topbar-end .lang-switch { padding: 6px 10px; }
}
.inline-new { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-new input, .inline-new select { width: auto !important; }
.toolbar .search select { min-height: 40px; }
.inline-new .num-input { width: 80px !important; }

/* ---------- entry portal (full page, before the app) ---------- */
.portal-page { min-height: 100vh; margin: 0; background:
  radial-gradient(900px 500px at 85% -10%, rgba(31, 95, 209, .16), transparent 60%),
  radial-gradient(800px 500px at 0% 110%, rgba(196, 122, 23, .14), transparent 60%), #f4f6fb; }
.portal-page::before { display: none; }
.portal-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 32px; }
.portal-brand { display: flex; align-items: center; gap: 12px; font-size: 17px; }
.portal-brand img { width: 44px; height: 44px; object-fit: contain; border-radius: 12px; background: #fff; padding: 3px; box-shadow: var(--shadow); }
.portal-nav { display: flex; align-items: center; gap: 8px; }
.portal-nav a { padding: 8px 14px; border-radius: 999px; color: var(--text); font-weight: 600; font-size: 13.5px; background: rgba(255, 255, 255, .8); border: 1px solid var(--border); }
.portal-nav a:hover { text-decoration: none; background: #fff; box-shadow: var(--shadow); }
.portal-user { display: inline-flex; align-items: center; gap: 8px; padding-inline-start: 6px !important; }
.portal-user .avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; background: linear-gradient(135deg, #3b7bea, #1f5fd1); }
.portal-nav .portal-logout { color: var(--danger); }
.portal { max-width: 1100px; margin: 20px auto 40px; padding: 0 24px; }
.portal-title { text-align: center; font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin: 10px 0 6px; }
.portal-hello { margin-bottom: 34px; font-size: 16px; }
.portal-cards { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 28px; }
.portal-card-wrap { position: relative; }
.portal-card { min-height: 380px; border-radius: 24px; padding: 34px 32px; background-size: cover; background-position: center; isolation: isolate; }
.portal-card.has-bg::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10, 18, 32, .25) 0%, rgba(10, 18, 32, .55) 45%, rgba(10, 18, 32, .88) 100%); }
.portal-card.has-bg.ws-projects::before { background: linear-gradient(180deg, rgba(23, 63, 143, .35) 0%, rgba(14, 33, 76, .6) 45%, rgba(10, 22, 52, .92) 100%); }
.portal-card.has-bg.ws-branches::before { background: linear-gradient(180deg, rgba(138, 79, 6, .3) 0%, rgba(80, 45, 4, .6) 45%, rgba(48, 26, 2, .92) 100%); }
.portal-card.has-bg::after { display: none; }
.portal-card h2 { font-size: 30px; font-weight: 800; }
.portal-card p { font-size: 15px; max-width: 420px; }
.portal-ico { backdrop-filter: blur(6px); }
.portal-go { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 999px; background: rgba(255, 255, 255, .18); backdrop-filter: blur(6px); transition: background .15s; }
.portal-card:hover .portal-go { background: #fff; color: var(--text); }
.portal-bg-form { position: absolute; top: 16px; inset-inline-end: 16px; display: flex; gap: 6px; z-index: 2; }
.portal-bg-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(0, 0, 0, .35); color: #fff; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; backdrop-filter: blur(6px); }
.portal-bg-btn:hover { background: rgba(0, 0, 0, .55); }
.portal-bg-btn svg { width: 16px; height: 16px; }
.portal-bg-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.portal-tip { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 22px; }
.portal .alert { max-width: 640px; margin-inline: auto; }
@media (max-width: 760px) {
  .portal-top { padding: 14px 16px; flex-wrap: wrap; }
  .portal-title { font-size: 26px; }
  .portal-card { min-height: 320px; padding: 26px 22px; }
  .portal-bg-btn span { display: none; }
}
.ws-home { display: flex; align-items: center; gap: 8px; margin: 12px 10px 0; padding: 7px 12px; border-radius: 10px; color: #aeb8c6; font-size: 12.5px; font-weight: 600; border: 1px dashed rgba(255, 255, 255, .14); }
.ws-home .nav-ico { width: 16px; height: 16px; }
.ws-home:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, .05); }
.ws-home + .ws-switch { margin-top: 8px; }
.perm-section { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 26px 0 12px; padding: 12px 16px; border-radius: 12px; background: #fff; border: 1px solid var(--border); border-inline-start: 4px solid var(--primary); }
.perm-section h3 { font-size: 16px; }
.perm-section.perm-branches { border-inline-start-color: #c47a17; }
.perm-section.perm-both { border-inline-start-color: #64748b; }
.portal-bg-pick .field { gap: 8px; }
.bg-thumb { height: 130px; border-radius: 14px; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, .85); font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }
.bg-thumb.ws-projects { background-color: #1f5fd1; background-image: linear-gradient(140deg, #2b6de0, #173f8f); }
.bg-thumb.ws-branches { background-color: #c47a17; background-image: linear-gradient(140deg, #c47a17, #8a4f06); }
.bg-thumb.wide { height: 160px; background-color: #141c28; }

/* portal cards v2: clear image on top, section name + enter button below */
.pcard { display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; background: #fff; color: var(--text); border: 1px solid var(--border); box-shadow: 0 14px 34px rgba(15, 27, 45, .10); transition: transform .2s, box-shadow .2s; }
.pcard:hover { transform: translateY(-4px); box-shadow: 0 22px 46px rgba(15, 27, 45, .16); text-decoration: none; color: var(--text); }
.pcard-img { display: flex; align-items: center; justify-content: center; height: 300px; background-size: cover; background-position: center; background-repeat: no-repeat; }
.pcard.ws-projects .pcard-img:not(.has-img) { background-image: linear-gradient(140deg, #2b6de0, #173f8f); }
.pcard.ws-branches .pcard-img:not(.has-img) { background-image: linear-gradient(140deg, #d68a22, #8a4f06); }
.pcard-ico { width: 96px; height: 96px; border-radius: 26px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .16); }
.pcard-ico .nav-ico { width: 52px; height: 52px; color: #fff; }
.pcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 24px; }
.pcard-foot b { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.pcard-go { min-height: 44px; padding: 10px 26px; font-size: 15px; border-radius: 12px; }
.pcard.ws-branches .pcard-go { background: linear-gradient(180deg, #d68a22, #b46d10); border-color: #b46d10; box-shadow: 0 4px 12px rgba(196, 122, 23, .3); }
@media (max-width: 760px) { .pcard-img { height: 210px; } .pcard-foot b { font-size: 20px; } }

/* branches dashboard: chat / mail / attendance cards */
.comm-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 22px; }
.comm-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 18px 20px; position: relative; overflow: hidden; }
.comm-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, #1f5fd1, #5b8def); }
.comm-mail::before { background: linear-gradient(90deg, #7c4ddb, #a98af0); }
.comm-att::before { background: linear-gradient(90deg, #12a46b, #4fd39b); }
.comm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.comm-head h3 { font-size: 16px; font-weight: 700; }
.comm-ico { width: 42px; height: 42px; flex: none; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); }
.comm-mail .comm-ico { background: #f1ebfd; color: #7c4ddb; }
.comm-att .comm-ico { background: #e3f6ee; color: #12a46b; }
.comm-ico svg { width: 22px; height: 22px; }
.comm-count { margin-inline-start: auto; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: var(--danger); color: #fff; font-style: normal; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 3px 10px rgba(179, 38, 30, .3); }
.comm-list { list-style: none; margin: 0 0 12px; padding: 0; flex: 1; }
.comm-list li + li { border-top: 1px solid #eef1f6; }
.comm-list a { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 4px; color: var(--text); border-radius: 8px; }
.comm-list a:hover { background: #f7faff; text-decoration: none; }
.comm-from { font-weight: 600; font-size: 13px; }
.comm-text { grid-column: 1 / -1; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comm-time { grid-row: 1; grid-column: 2; font-size: 11.5px; color: var(--muted); direction: ltr; }
.comm-list li.unread .comm-text { color: var(--text); font-weight: 600; }
.comm-list li.unread .comm-from::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-inline-end: 6px; vertical-align: middle; }
.comm-list li.empty { color: var(--muted); padding: 18px 4px; text-align: center; font-size: 13px; }
.comm-open { align-self: flex-start; }
.comm-actions { display: flex; gap: 8px; }
.att-today { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; flex: 1; align-content: start; }
.att-today div { padding: 10px 12px; border-radius: 12px; background: #f6f8fc; }
.att-today b { display: block; font-size: 24px; font-weight: 800; }
.att-today span { font-size: 12px; color: var(--muted); }
.att-today .ok b { color: var(--success); }
.att-today .bad b { color: var(--danger); }
.att-today .warn b { color: #d98a1c; }
.att-today .muted b { color: var(--muted); }

/* fingerprint devices */
.dev-setup { display: flex; gap: 18px; align-items: flex-start; border-inline-start: 4px solid #12a46b; }
.dev-setup-ico { width: 52px; height: 52px; flex: none; border-radius: 14px; background: #e3f6ee; color: #12a46b; display: inline-flex; align-items: center; justify-content: center; }
.dev-setup-ico svg { width: 28px; height: 28px; }
.dev-setup h3 { font-size: 16px; margin-bottom: 4px; }
.dev-steps { margin: 8px 0 0; padding-inline-start: 20px; line-height: 2; font-size: 13.5px; }
.bg-missing { background: rgba(179, 38, 30, .85); color: #fff; padding: 6px 12px; border-radius: 8px; }

/* POS offline banner */
.pos-net { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 9px 14px; border-radius: 12px; font-weight: 700; font-size: 14px; }
.pos-net.off { background: #fdecea; color: #b3261e; border: 1px solid #f5c2bd; }
.pos-net.wait { background: #fff4e2; color: #9a5b06; border: 1px solid #f3d6a4; }
.pos-net-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: none; animation: posPulse 1.4s infinite; }
.pos-net .btn { margin-inline-start: auto; }
@keyframes posPulse { 50% { opacity: .3; } }
.pos-net:not([hidden]) + .pos { height: calc(100vh - 140px); }

/* install as app button */
.install-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; color: #fff; background: linear-gradient(180deg, #2b6de0, #1f5fd1); box-shadow: 0 3px 10px rgba(31, 95, 209, .3); }
.install-btn[hidden] { display: none; }
.pos-mode .install-btn { background: linear-gradient(180deg, #d68a22, #b46d10); box-shadow: 0 3px 10px rgba(196, 122, 23, .3); }
@media (display-mode: standalone) { .install-btn { display: none !important; } }

/* activity watermark at the bottom corner (buildings for projects, shop fronts for branches) */
.main.wm-projects::after, .main.wm-branches::after {
  content: ""; position: fixed; bottom: 0; inset-inline-end: 0; width: min(520px, 45vw); height: min(260px, 22vw);
  background: url('../img/wm-projects.svg') no-repeat bottom center / contain; opacity: .10; pointer-events: none; z-index: 0;
}
.main.wm-branches::after { background-image: url('../img/wm-branches.svg'); }
.main > .content { position: relative; z-index: 1; }
@media print { .main::after { display: none !important; } }
