:root {
  --portal-ink: #14213d;
  --portal-muted: #60708a;
  --portal-line: #d8e4ef;
  --portal-surface: #ffffff;
  --portal-surface-soft: #f5f9fc;
  --portal-navy: #123b63;
  --portal-blue: #087ea4;
  --portal-teal: #0b9f8a;
  --portal-success: #087a5b;
  --portal-warning: #a56212;
  --portal-danger: #b53a4b;
  --portal-shadow: 0 14px 34px rgba(21, 48, 77, .10);
}

html { background: #eaf1f6; }
body {
  color: var(--portal-ink) !important;
  background-color: #eaf1f6 !important;
  background-image: linear-gradient(135deg, rgba(18, 59, 99, .055) 25%, transparent 25%), linear-gradient(225deg, rgba(8, 158, 138, .045) 25%, transparent 25%) !important;
  background-size: 28px 28px !important;
  font-family: "Noto Sans", "Segoe UI", sans-serif !important;
  font-size: 13px !important;
  line-height: 1.45 !important;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(8, 126, 164, .32); outline-offset: 2px; }

/* Dashboard */
.sidebar { background: linear-gradient(180deg, #123b63, #0d2d4d) !important; border-right: 0 !important; box-shadow: 8px 0 28px rgba(9, 35, 59, .16) !important; }
.brand { border-bottom-color: rgba(255, 255, 255, .14) !important; }
.brand h1, .nav-btn, .logout { color: #f8fcff !important; }
.brand p, .version { color: #aec5d7 !important; }
.logo { background: transparent !important; color: #123b63 !important; box-shadow: none !important; }
.logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.nav-btn:hover, .nav-btn.active { background: rgba(255, 255, 255, .13) !important; border-color: rgba(255, 255, 255, .14) !important; color: #ffffff !important; box-shadow: inset 3px 0 0 #f7b84b !important; }
.nav-icon { background: rgba(255, 255, 255, .12) !important; box-shadow: none !important; }
.nav-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .brand h1, .sidebar .nav-btn, .sidebar .nav-sub-btn, .sidebar .logout { font-family: "Segoe UI", "Noto Sans", sans-serif !important; }
.sidebar .brand h1 { font-weight: 700 !important; }
.nav-btn { min-height: 42px !important; color: #d9e7f1 !important; font-size: 13px !important; font-weight: 600 !important; letter-spacing: .01em; }
.nav-btn.active, .nav-btn:hover { color: #fff !important; font-weight: 650 !important; }
.nav-icon { width: 27px !important; height: 27px !important; border-radius: 8px !important; }
.nav-group-trigger { position: relative; }
.nav-group-caret { display: grid; width: 18px; height: 18px; margin-left: auto; place-items: center; color: #b9ccda; transition: transform .16s ease; }
.nav-group-caret svg, .profile-menu-caret svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.nav-group.open .nav-group-caret { transform: rotate(180deg); }
.nav-group.active .nav-group-trigger { background: rgba(255, 255, 255, .09) !important; border-color: transparent !important; box-shadow: none !important; }
.nav-submenu { display: grid; gap: 3px; margin: 3px 0 5px 38px; padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, .22); }
.nav-submenu[hidden] { display: none; }
.nav-sub-btn { position: relative; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; color: #bfd2df; font: inherit; font-size: 12px; font-weight: 500; letter-spacing: .01em; text-align: left; cursor: pointer; }
.nav-sub-btn:hover, .nav-sub-btn.active { background: rgba(255, 255, 255, .12); color: #fff; font-weight: 600; }
.nav-sub-btn.active::before { position: absolute; left: -16px; width: 8px; height: 8px; border: 2px solid #123b63; border-radius: 50%; background: #f7b84b; box-shadow: 0 0 0 2px #f7b84b; content: ""; }
.nav-sub-icon { display: grid; width: 17px; height: 17px; place-items: center; color: #f7b84b; }
.nav-sub-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.logout { background: rgba(255, 255, 255, .10) !important; border-color: rgba(255, 255, 255, .16) !important; font-size: 13px !important; font-weight: 600 !important; }
@media (min-width: 981px) {
  .sidebar-collapsed .app-shell { transition: grid-template-columns .18s ease; }
  .sidebar-collapsed .app-shell:has(.sidebar:hover),
  .sidebar-collapsed .app-shell:has(.sidebar:focus-within) { grid-template-columns: var(--sidebar) minmax(0, 1fr) !important; }
  .sidebar-collapsed .sidebar { overflow: visible; }
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .brand { justify-content: center; }
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .brand > div:last-child,
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .nav-label,
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .nav-group-caret,
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .nav-submenu,
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .logout { display: none !important; }
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .nav-btn { justify-content: center; padding-left: 0 !important; padding-right: 0 !important; }
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .nav-group { width: 100%; }
  .sidebar-collapsed .sidebar:hover,
  .sidebar-collapsed .sidebar:focus-within { padding-inline: 14px !important; }
  .sidebar-collapsed .sidebar:hover .brand > div:last-child,
  .sidebar-collapsed .sidebar:focus-within .brand > div:last-child,
  .sidebar-collapsed .sidebar:hover .nav-label,
  .sidebar-collapsed .sidebar:focus-within .nav-label,
  .sidebar-collapsed .sidebar:hover .nav-group-caret,
  .sidebar-collapsed .sidebar:focus-within .nav-group-caret,
  .sidebar-collapsed .sidebar:hover .sidebar-foot,
  .sidebar-collapsed .sidebar:focus-within .sidebar-foot { display: block !important; }
  .sidebar-collapsed .sidebar:hover .nav-btn,
  .sidebar-collapsed .sidebar:focus-within .nav-btn { justify-content: flex-start !important; padding-left: 12px !important; padding-right: 12px !important; }
  .sidebar-collapsed .sidebar:hover .nav-submenu:not([hidden]),
  .sidebar-collapsed .sidebar:focus-within .nav-submenu:not([hidden]) { display: grid !important; }
}
.workspace { max-width: 1580px; width: 100%; margin: 0 auto; }
.topbar { background: rgba(255, 255, 255, .72) !important; border-radius: 0 0 14px 14px; padding: 14px 16px !important; backdrop-filter: blur(10px); }
.topbar h2 { font-size: 19px !important; letter-spacing: 0 !important; color: var(--portal-navy); }
.topbar p, .card-subtitle, .muted { font-size: 12px !important; }
.sidebar-toggle { border-radius: 9px !important; color: var(--portal-navy) !important; }
.user-chip { border-color: var(--portal-line) !important; background: #fff !important; }
.avatar { background: var(--portal-teal) !important; }
.profile-menu { position: relative; }
.profile-menu-toggle { cursor: pointer; }
.profile-menu-caret { display: grid; width: 18px; height: 18px; place-items: center; color: var(--portal-muted); transition: transform .16s ease; }
.profile-menu-toggle[aria-expanded="true"] .profile-menu-caret { transform: rotate(180deg); }
.profile-menu-list { position: absolute; z-index: 80; top: calc(100% + 8px); right: 0; width: 250px; padding: 6px; border: 1px solid var(--portal-line); border-radius: 10px; background: #fff; box-shadow: 0 18px 38px rgba(21, 48, 77, .18); }
.profile-menu-list[hidden] { display: none; }
.profile-menu-item { display: grid; gap: 1px; width: 100%; padding: 10px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--portal-ink); text-align: left; text-decoration: none; cursor: pointer; }
.profile-menu-item:hover, .profile-menu-item:focus-visible { background: #edf7f8; outline: 0; }
.profile-menu-item span { font-weight: 800; }
.profile-menu-item small { color: var(--portal-muted); font-size: 12px; }
.profile-menu-item.danger { margin-top: 4px; border-top: 1px solid #e8edf1; border-radius: 0 0 7px 7px; color: var(--portal-danger); }
.profile-menu-item.danger:hover { background: #fff2f3; }
.card, .stat, .info-box, .tabs, .ticket-inbox { border-radius: 10px !important; border-color: var(--portal-line) !important; box-shadow: var(--portal-shadow) !important; background: var(--portal-surface) !important; }
.card { border-top: 3px solid rgba(8, 126, 164, .62) !important; }
.card-title, .invoice-no, .pane-title h3 { color: var(--portal-navy) !important; letter-spacing: 0 !important; }
.card-title { font-size: 11px !important; }
.invoice-no { font-size: 23px !important; }
.pane-title h3 { font-size: 17px !important; }
.big-total { color: var(--portal-navy) !important; font-size: 34px !important; letter-spacing: 0 !important; }
.stat { border-top: 3px solid rgba(11, 159, 138, .54) !important; }
.notice { border-radius: 10px !important; border-color: #b9e6de !important; background: #edfaf7 !important; }
.notice-icon { background: var(--portal-teal) !important; }
.notice-billing-active { border: 1px solid #f3bb4f !important; border-left: 5px solid #e58b10 !important; background: linear-gradient(90deg, #fff2d3, #fffaf0) !important; box-shadow: 0 8px 18px rgba(194, 112, 9, .13); }
.notice-billing-active .notice-icon { background: #e58b10 !important; color: #fff !important; box-shadow: 0 0 0 4px rgba(229, 139, 16, .16); }
.notice-billing-active b { color: #8a4308 !important; }
.notice-billing-active span { color: #74440d !important; }
.account-list .row { display: grid !important; grid-template-columns: minmax(112px, 34%) minmax(0, 1fr); align-items: start; border-bottom-color: #e7eef4 !important; }
.account-list .row span { min-width: 0; }
.account-list .row strong { min-width: 0; overflow-wrap: anywhere; text-align: right !important; }
.btn { border-radius: 8px !important; font-weight: 800 !important; }
.btn { min-height: 36px !important; padding: 8px 11px !important; font-size: 12px !important; }
.btn.primary, .btn:not(.soft):not(.good) { background: var(--portal-blue) !important; border-color: var(--portal-blue) !important; }
.btn.good { background: var(--portal-success) !important; border-color: var(--portal-success) !important; }
.btn.soft { background: #f3f8fb !important; border-color: #cfdee9 !important; color: var(--portal-navy) !important; }
.pill.good { background: #e6f7f1 !important; color: var(--portal-success) !important; }
.pill.warn { background: #fff5df !important; color: var(--portal-warning) !important; }
.pill.bad { background: #fff0f2 !important; color: var(--portal-danger) !important; }
.portal-table th { background: #eaf4f8 !important; color: var(--portal-navy) !important; }
.portal-table tr:hover td { background: #f3fafb !important; }
.tab-btn.active { color: var(--portal-blue) !important; border-bottom-color: var(--portal-blue) !important; }
.field input, .field select, .field textarea, .pay-field select { border-color: #c8d8e5 !important; border-radius: 8px !important; background: #fbfdff !important; }
.field input:focus, .field select:focus, .field textarea:focus, .pay-field select:focus { border-color: var(--portal-blue) !important; box-shadow: 0 0 0 3px rgba(8, 126, 164, .12) !important; }
.account-password-hint { margin-top: -3px; }
.modal { border-radius: 12px !important; border-top: 4px solid var(--portal-teal); }
.modal-head { background: #f3f9fb !important; }

/* Login */
.auth-shell { padding: 28px 18px !important; }
.intro, .panel { border-radius: 12px !important; border-color: var(--portal-line) !important; box-shadow: var(--portal-shadow) !important; }
.intro { background: linear-gradient(150deg, #123b63, #0d5373) !important; color: #fff !important; }
.intro .brand h1, .intro h2 { color: #fff !important; letter-spacing: 0 !important; }
.intro .brand p, .intro-copy, .feature small { color: #d6e6f0 !important; }
.intro .logo { background: #f7b84b !important; color: var(--portal-navy) !important; }
.feature { border-radius: 9px !important; border-color: rgba(255, 255, 255, .17) !important; background: rgba(255, 255, 255, .09) !important; box-shadow: none !important; }
.feature span:first-child { background: #f7b84b !important; color: var(--portal-navy) !important; }
.panel { background: #fff !important; }
.panel h2 { color: var(--portal-navy); letter-spacing: 0 !important; }
.panel h2 { font-size: 20px !important; }
.intro h2 { font-size: 28px !important; }
.intro-copy, .feature small, .help, .field label { font-size: 12px !important; }
.password-toggle { border-radius: 6px !important; color: var(--portal-blue) !important; }
.help { border-radius: 8px !important; border-color: #cfe0ea !important; background: #f2f8fa !important; }

/* Browser invoice views only. Print keeps the established A4 document intact. */
.toolbar { border-radius: 10px; background: rgba(255, 255, 255, .78); padding: 8px !important; box-shadow: 0 8px 20px rgba(21, 48, 77, .07); }
.sheet { border-radius: 10px !important; border-color: #d6e3eb !important; box-shadow: var(--portal-shadow) !important; }
.party-grid > div, .totals, .pay-instructions { border-radius: 8px !important; }
.invoice-table th { background: #eaf4f8 !important; color: var(--portal-navy) !important; }
@media print {
  body { background: #fff !important; }
  .toolbar { display: none !important; }
  .sheet { box-shadow: none !important; border: 0 !important; border-radius: 0 !important; }
}
@media (max-width: 980px) {
  .workspace { padding: 10px 12px 24px !important; }
  .topbar { border-radius: 10px; }
}
@media (max-width: 640px) {
  .auth-shell { padding: 12px !important; }
  .intro, .panel { border-radius: 10px !important; }
  .topbar { align-items: flex-start !important; }
  .user-chip { max-width: 48px; overflow: hidden; padding: 4px !important; }
  .chip-copy { display: none !important; }
  .profile-menu-list { position: fixed; top: 68px; right: 12px; width: min(280px, calc(100vw - 24px)); }
  .card, .stat, .info-box, .tabs, .ticket-inbox { border-radius: 8px !important; }
  .account-list .row { grid-template-columns: 1fr !important; gap: 3px; }
  .account-list .row strong { text-align: left !important; }
  .toolbar { width: calc(100% - 16px) !important; gap: 5px !important; }
}