/* ============================================================================
   [FR]-LIMPS – Design System
   Palette & typography taken from the official icon set / brand sheet.
   ========================================================================== */
:root {
  --navy: #0B2545;
  --navy-700: #13315C;
  --navy-600: #1B4172;
  --teal: #17A2A2;
  --teal-600: #128F8F;
  --teal-100: #E2F4F4;
  --teal-200: #BEE6E5;
  --sky: #9FD3DA;
  --ink: #1F2A37;
  --muted: #5B6B7B;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;
  --bg: #F4F7FB;
  --bg-soft: #EEF3F9;
  --white: #FFFFFF;
  --success: #1FA971;
  --success-bg: #E5F6EE;
  --danger: #E0524B;
  --danger-bg: #FCEBEA;
  --warning: #E0A23B;
  --warning-bg: #FCF3E3;
  --info: #2F80C7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(11, 37, 69, .06), 0 1px 3px rgba(11, 37, 69, .05);
  --shadow: 0 4px 16px rgba(11, 37, 69, .08);
  --shadow-lg: 0 12px 40px rgba(11, 37, 69, .16);
  --sidebar-w: 264px;
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Montserrat', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
.icon { display: block; flex-shrink: 0; }
a { color: var(--teal-600); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; color: var(--navy); font-weight: 700; }
[v-cloak] { display: none; }

/* ----------------------------- Buttons ----------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: 13.5px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: .15s ease; white-space: nowrap; line-height: 1;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-700); }
.btn-teal { background: var(--teal); color: #fff; }
.btn-teal:hover:not(:disabled) { background: var(--teal-600); }
.btn-ghost { background: var(--white); color: var(--navy); border-color: var(--line-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.94); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; justify-content: center; }

/* ----------------------------- Login ------------------------------------- */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.login-brand {
  background: linear-gradient(150deg, var(--navy) 0%, var(--navy-600) 55%, var(--teal-600) 140%);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-brand::after {
  content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(23,162,162,.35), transparent 65%);
}
.login-brand .logo-box { background: rgba(255,255,255,.95); border-radius: 16px; padding: 22px 26px; display: inline-block; width: max-content; box-shadow: var(--shadow); }
.login-brand h2 { color: #fff; font-size: 30px; line-height: 1.25; max-width: 460px; }
.login-brand p { color: #cfe3f2; max-width: 440px; font-size: 15px; }
.login-features { display: grid; gap: 14px; }
.login-feature { display: flex; gap: 12px; align-items: center; color: #dbeaf6; font-size: 14px; }
.login-feature .chip { background: rgba(255,255,255,.12); border-radius: 10px; padding: 8px; color: var(--sky); }
.login-card-side { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 24px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); margin-bottom: 28px; }
.login-hint { margin-top: 18px; font-size: 12.5px; color: var(--muted); background: var(--teal-100); border: 1px solid var(--teal-200); padding: 10px 12px; border-radius: var(--radius-sm); }

/* ----------------------------- App shell --------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--navy); color: #cdd9e8; flex-shrink: 0;
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40;
  transition: transform .25s ease;
}
.sidebar-logo { padding: 20px 20px 14px; display: flex; align-items: center; gap: 12px; }
.sidebar-logo .mark { width: 40px; height: 40px; }
.sidebar-logo .txt b { color: #fff; font-size: 16px; display: block; letter-spacing: .3px; }
.sidebar-logo .txt span { color: var(--sky); font-size: 10.5px; }
.nav { padding: 8px 12px; overflow-y: auto; flex: 1; }
.nav-section { color: #6f86a6; font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; margin: 16px 12px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: #b9c8db; cursor: pointer; font-weight: 600; font-size: 13.5px; transition: .15s; margin-bottom: 2px;
}
.nav-item:hover { background: var(--navy-700); color: #fff; }
.nav-item.active { background: var(--teal); color: #fff; box-shadow: var(--shadow-sm); }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: #6f86a6; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 64px; background: var(--white); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar .title { font-size: 18px; font-weight: 700; color: var(--navy); }
.topbar .spacer { flex: 1; }
.burger { display: none; }
.user-menu { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px 8px; border-radius: var(--radius-sm); }
.user-menu:hover { background: var(--bg-soft); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-menu .u-name { font-weight: 600; font-size: 13px; color: var(--navy); }
.user-menu .u-role { font-size: 11px; color: var(--muted); }
.content { padding: 24px; flex: 1; }

.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 200px; padding: 6px; z-index: 50;
}
.dropdown-panel button { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; font: inherit; color: var(--ink); text-align: left; }
.dropdown-panel button:hover { background: var(--bg-soft); }

/* ----------------------------- Cards / layout ---------------------------- */
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .desc { color: var(--muted); font-size: 13px; }
.page-head .spacer { flex: 1; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.card-head h3 { font-size: 15px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

.grid { display: grid; gap: 18px; }
.grid-kpi { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .grid-kpi { grid-template-columns: repeat(2, 1fr); } .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.kpi { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.kpi .ic { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--teal-100); color: var(--teal-600); }
.kpi .ic.navy { background: #E7EDF6; color: var(--navy-600); }
.kpi .ic.green { background: var(--success-bg); color: var(--success); }
.kpi .ic.amber { background: var(--warning-bg); color: var(--warning); }
.kpi .v { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 12.5px; font-weight: 600; }

/* ----------------------------- Tables ------------------------------------ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; padding: 12px 16px; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--line); background: var(--bg-soft); white-space: nowrap; }
table.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--bg-soft); }
.t-actions { display: flex; gap: 6px; justify-content: flex-end; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .icon { margin: 0 auto 12px; color: var(--line-strong); }

/* ----------------------------- Badges ------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-open { background: #E7EDF6; color: var(--navy-600); }
.b-progress { background: var(--warning-bg); color: var(--warning); }
.b-completed { background: var(--success-bg); color: var(--success); }
.b-cancelled { background: #EEF1F4; color: var(--muted); }
.b-success { background: var(--success-bg); color: var(--success); }
.b-danger { background: var(--danger-bg); color: var(--danger); }
.b-neutral { background: var(--bg-soft); color: var(--muted); }
.b-high { background: var(--danger-bg); color: var(--danger); }
.b-normal { background: #E7EDF6; color: var(--navy-600); }
.b-low { background: var(--bg-soft); color: var(--muted); }

/* ----------------------------- Forms ------------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.field .req { color: var(--danger); }
.input, .select, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; color: var(--ink); background: #fff; transition: .15s;
}
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-100); }
textarea.input { resize: vertical; min-height: 80px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .input { padding-left: 36px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .col-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .col-2 { grid-column: span 1; } }
.field-err { color: var(--danger); font-size: 12px; margin-top: 5px; }
/* label.switch matches the specificity of `.field label` (which sets display:block)
   and is declared later, so the flex layout wins even inside a .field wrapper. */
label.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; line-height: 1; margin: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.switch .track { flex: 0 0 auto; width: 44px; min-width: 44px; height: 24px; background: var(--line-strong); border-radius: 999px; position: relative; transition: background .2s; box-sizing: border-box; }
.switch .track::after { content: ""; position: absolute; width: 18px; height: 18px; background: #fff; border-radius: 50%; top: 3px; left: 3px; transition: left .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::after { left: 23px; }
.switch .switch-label { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.switch .switch-label.on { color: var(--teal-600); }

/* ----------------------------- Combobox ---------------------------------- */
.combobox { position: relative; }
.combobox-panel { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 70; max-height: 240px; overflow-y: auto; padding: 4px; }
.combobox-item { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.combobox-item.active { background: var(--bg-soft); }
.combobox-item.selected { color: var(--teal-600); font-weight: 600; }

/* ----------------------------- Modal ------------------------------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(11,37,69,.45); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 80; overflow-y: auto; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: pop .18s ease; }
.modal.lg { max-width: 820px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; flex: 1; }
.modal-body { padding: 22px; max-height: 64vh; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ----------------------------- Toasts ------------------------------------ */
.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { display: flex; gap: 12px; align-items: flex-start; background: #fff; border-left: 4px solid var(--teal); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 13px 16px; min-width: 280px; max-width: 380px; animation: slidein .2s ease; }
.toast.success { border-color: var(--success); } .toast.success .icon { color: var(--success); }
.toast.error { border-color: var(--danger); } .toast.error .icon { color: var(--danger); }
.toast.info { border-color: var(--info); } .toast.info .icon { color: var(--info); }
.toast .t-title { font-weight: 600; font-size: 13px; color: var(--navy); }
.toast .t-msg { font-size: 12.5px; color: var(--muted); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ----------------------------- Misc -------------------------------------- */
.pagination { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 14px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--teal-200); border-top-color: var(--teal); border-radius: 50%; animation: spin .7s linear infinite; }
.loading-full { display: grid; place-items: center; padding: 60px; }
@keyframes spin { to { transform: rotate(360deg); } }
.chart-box { position: relative; height: 280px; }
.stat-line { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.stat-line:last-child { border-bottom: 0; }
.progress { height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--teal); border-radius: 999px; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .perm-grid { grid-template-columns: 1fr; } }
.perm-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.perm-group h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--teal-600); margin-bottom: 10px; }
.perm-check { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 13px; cursor: pointer; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tol-bar { display: flex; height: 100%; }

.scrollback { display: none; }

/* ----------------------------- Responsive -------------------------------- */
.overlay-bg { display: none; }
@media (max-width: 980px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .burger { display: inline-flex; }
  .overlay-bg.show { display: block; position: fixed; inset: 0; background: rgba(11,37,69,.4); z-index: 35; }
  .content { padding: 16px; }
  .grid-kpi { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .grid-kpi { grid-template-columns: 1fr; }
  .user-menu .u-name, .user-menu .u-role { display: none; }
}
