:root {
  --bg: #eef6fb;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-2: rgba(247, 252, 255, 0.98);
  --line: rgba(115, 149, 174, 0.24);
  --text: #133243;
  --muted: #3f5f72;
  --accent: #22bda5;
  --accent-2: #3a9bff;
  --focus-ring: #0f8ddc;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Space Grotesk', sans-serif; color: var(--text); background: radial-gradient(circle at 10% 8%, #dff0fb 0%, #eef6fb 42%), linear-gradient(180deg, #f5fbff 0%, #e8f3fb 100%); }
.shell { max-width: min(1860px, 98vw); margin: 0 auto; padding: 1rem; }
.card { background: linear-gradient(140deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); border-radius: 14px; padding: 0.8rem; box-shadow: 0 10px 24px rgba(48, 89, 114, 0.08); }
.hidden { display: none !important; }
.small { color: var(--muted); font-size: 0.85rem; line-height: 1.35; }

.login-card { max-width: 460px; margin: 3rem auto; }
.login-card h1 { margin: 0 0 0.75rem; font-size: 1.3rem; }
.brand-login { margin-bottom: 0.55rem; }
.brand-login img { width: 280px; max-width: 100%; height: auto; display: block; }

.app { display: grid; grid-template-columns: 240px 1fr; gap: 0.8rem; align-items: start; }
.sidebar { display: grid; gap: 0.35rem; align-content: start; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; overflow-x: hidden; }
.sidebar { scrollbar-width: thin; scrollbar-color: #9ec7db rgba(228, 242, 251, 0.9); }
.sidebar::-webkit-scrollbar { width: 10px; }
.sidebar::-webkit-scrollbar-track { background: rgba(228, 242, 251, 0.9); border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #b7d9ea, #8ebcd3); border-radius: 10px; border: 2px solid rgba(228, 242, 251, 0.9); }
.sidebar::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #9ecde3, #79acc8); }
.sidebar h2 { margin: 0 0 0.4rem; font-size: 1rem; }
.brand-sidebar { margin-bottom: 0.2rem; }
.brand-sidebar img { width: 190px; max-width: 100%; height: auto; display: block; }
.menu-group { border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.92); overflow: hidden; }
.menu-group summary { list-style: none; cursor: pointer; user-select: none; font-size: 0.82rem; font-weight: 700; color: #2c5a75; padding: 0.5rem 0.6rem; border-bottom: 1px solid rgba(115, 149, 174, 0.18); background: linear-gradient(180deg, rgba(232, 245, 254, 0.8), rgba(245, 251, 255, 0.8)); }
.menu-group summary::-webkit-details-marker { display: none; }
.menu-group summary::after { content: '▾'; float: right; color: var(--muted); transform: rotate(-90deg); transition: transform 0.16s ease; }
.menu-group[open] summary::after { transform: rotate(0deg); }
.menu-group-items { display: grid; gap: 0.3rem; padding: 0.45rem; }
.menu-item { text-align: left; border: 1px solid var(--line); background: #ffffff; color: var(--text); border-radius: 8px; padding: 0.58rem 0.7rem; font-size: 0.9rem; min-height: 42px; cursor: pointer; }
.menu-item.active { background: linear-gradient(140deg, rgba(34,189,165,0.2), rgba(58,155,255,0.16)); border-color: rgba(58, 155, 255, 0.4); }

.main { display: grid; gap: 0.8rem; align-content: start; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 0.8rem; }
.topbar h1 { margin: 0; font-size: 1.3rem; }
.topbar p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.86rem; }
.top-actions { display: flex; gap: 0.4rem; align-items: center; }
.top-branding { display: flex; align-items: center; gap: 0.6rem; }
.top-branding img { width: 34px; height: 34px; border-radius: 8px; }

.form { display: grid; gap: 0.45rem; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; }
.password-field { display: grid; grid-template-columns: 1fr auto; gap: 0.4rem; align-items: center; }
.password-field .btn { min-height: 42px; padding: 0.5rem 0.68rem; }
.icon-btn { min-width: 42px; padding: 0.4rem; display: inline-grid; place-items: center; }
.icon-btn span { font-size: 1rem; line-height: 1; }
input, select, textarea { width: 100%; background: #ffffff; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 0.52rem 0.62rem; min-height: 42px; font-size: 0.9rem; line-height: 1.35; }
input::placeholder, textarea::placeholder { color: #577488; opacity: 1; }
textarea { min-height: 80px; resize: vertical; }
.btn { border: none; border-radius: 9px; padding: 0.56rem 0.8rem; min-height: 42px; font-size: 0.9rem; font-weight: 700; cursor: pointer; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #051d24; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button:focus-visible, .btn:focus-visible, .menu-item:focus-visible, .link-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.entity-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(520px, 1fr); gap: 0.8rem; align-items: start; }
.add-pane { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
.add-pane .form-grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.add-pane .field { min-width: 0; }
@media (max-width: 1100px) { .app { grid-template-columns: 1fr; } .sidebar { position: static; grid-template-columns: repeat(2, minmax(0,1fr)); } .entity-layout { grid-template-columns: 1fr; } }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; border-bottom: 1px solid rgba(121,167,176,0.2); padding: 0.46rem; font-size: 0.85rem; line-height: 1.35; vertical-align: top; }
th { color: #234e67; background: rgba(225, 241, 252, 0.55); }
thead th { position: sticky; top: 0; z-index: 2; background: rgba(225, 241, 252, 0.98); backdrop-filter: blur(2px); }
.sort-btn { background: transparent; border: none; color: inherit; cursor: pointer; font: inherit; padding: 0; }

.row-actions { display: flex; gap: 0.3rem; }
.row-actions button { background: transparent; border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 0.4rem 0.56rem; min-height: 38px; font-size: 0.84rem; cursor: pointer; }
.status-chip { display: inline-flex; align-items: center; gap: 0.28rem; border-radius: 999px; border: 1px solid var(--line); padding: 0.12rem 0.45rem; font-size: 0.76rem; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.status-chip i { font-style: normal; font-size: 0.72rem; width: 14px; height: 14px; display: inline-grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,0.72); }
.status-chip.positive { color: #0f7357; background: #ddf7ef; border-color: #9ddcc7; }
.status-chip.warning { color: #875700; background: #fff0d2; border-color: #e7c98e; }
.status-chip.danger { color: #a02a2a; background: #ffe3e3; border-color: #eab1b1; }
.status-chip.info { color: #1f587e; background: #dff2ff; border-color: #a8d2ef; }
.status-chip.neutral { color: #35566b; background: #ecf4f9; border-color: #bfd5e3; }

.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }
.list-tools { display: flex; gap: 0.4rem; margin-bottom: 0.55rem; flex-wrap: wrap; }
.list-tools input, .list-tools select { max-width: 260px; }
.list-meta { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; }
.field { display: grid; gap: 0.2rem; }
.field-help { color: #4a6a7d; font-size: 0.76rem; line-height: 1.35; margin-top: -0.02rem; }
.field-error { min-height: 14px; color: #c74b4b; font-size: 0.72rem; }
.invalid { border-color: #d36262 !important; }
.empty-state-msg { padding: 0.6rem 0.2rem; color: #46657a; font-size: 0.86rem; line-height: 1.4; }

.toast { position: fixed; right: 12px; bottom: 12px; background: #ffffff; border: 1px solid #89b3cb; border-radius: 10px; padding: 0.5rem 0.7rem; opacity: 0; transition: opacity 0.2s ease; box-shadow: 0 8px 20px rgba(39, 88, 116, 0.15); }
.toast.show { opacity: 1; }

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(21, 44, 58, 0.24); backdrop-filter: blur(2px); }
.modal-card { position: relative; width: min(960px, 94vw); max-height: 88vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.modal-head h3 { margin: 0; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.45rem; margin: 0.55rem 0; }
.mini-stat { border: 1px solid var(--line); border-radius: 8px; padding: 0.45rem; display: grid; gap: 0.2rem; background: rgba(240, 249, 255, 0.92); }
.mini-stat span { color: var(--muted); font-size: 0.76rem; }
.mini-stat strong { font-size: 1.05rem; }
.tenant-nav-grid { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
.approval-popup { display: grid; gap: 0.65rem; }
.approval-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.dashboard-layout { display: grid; gap: 0.65rem; }
.dashboard-hero { display: grid; grid-template-columns: 1.45fr 1fr; gap: 0.7rem; align-items: center; padding: 0.85rem 0.95rem; background: linear-gradient(135deg, #112744 0%, #0f345b 55%, #0d2543 100%); color: #eaf6ff; border-color: rgba(116, 157, 196, 0.32); }
.dashboard-hero h2 { margin: 0 0 0.28rem; font-size: 1.68rem; line-height: 1.15; letter-spacing: 0.01em; color: #f4fbff; font-weight: 700; }
.dashboard-hero p { margin: 0; color: rgba(221, 241, 255, 0.9); max-width: 760px; font-size: 0.9rem; line-height: 1.4; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.7rem; }
.hero-badge { border: 1px solid rgba(162, 207, 245, 0.3); border-radius: 999px; padding: 0.24rem 0.55rem; background: rgba(141, 191, 230, 0.14); color: #dff2ff; font-size: 0.73rem; line-height: 1.2; }
.hero-badge strong { color: #ffffff; margin-left: 0.2rem; }
.hero-actions { display: flex; gap: 0.45rem; justify-content: flex-end; flex-wrap: wrap; }
.link-btn { background: transparent; border: none; padding: 0.26rem 0.1rem; min-height: 36px; color: #e4f3ff; cursor: pointer; font-weight: 700; font-size: 0.88rem; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: #ffffff; }
.dashboard-hero .btn.ghost { background: rgba(255, 255, 255, 0.1); color: #eef8ff; border-color: rgba(189, 218, 240, 0.38); }
.dashboard-hero .btn { color: #052133; }
.dashboard-head { display: flex; justify-content: space-between; align-items: end; gap: 0.7rem; }
.home-filter { display: flex; gap: 0.45rem; align-items: end; flex-wrap: wrap; }
.home-filter input { min-width: 150px; }
.dashboard-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.5rem; }
.dashboard-kpis .kpi-card { min-height: 92px; padding: 0.62rem 0.68rem; }
.kpi-card { position: relative; overflow: hidden; }
.kpi-card::after { content: ""; position: absolute; right: -28px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: linear-gradient(160deg, rgba(44, 186, 165, 0.2), rgba(58, 155, 255, 0.2)); }
.kpi-card h4 { margin: 0; color: var(--muted); font-size: 0.77rem; text-transform: uppercase; letter-spacing: 0.03em; position: relative; z-index: 1; }
.kpi-card p { margin: 0.28rem 0 0; font-size: 1.34rem; font-weight: 700; line-height: 1.1; color: var(--text); position: relative; z-index: 1; }
.kpi-card.clickable { width: 100%; text-align: left; cursor: pointer; transition: transform 0.15s ease, border-color 0.15s ease; color: var(--text); font: inherit; appearance: none; -webkit-appearance: none; }
.kpi-card.clickable:hover { transform: translateY(-2px); border-color: rgba(58, 194, 255, 0.6); }
.chart-card h3 { margin-top: 0; font-size: 1.02rem; letter-spacing: 0.01em; }
.dashboard-main-row { display: grid; grid-template-columns: 1.35fr 1fr; gap: 0.65rem; align-items: start; }
.chart-wrap { width: 100%; height: 300px; border: 1px solid var(--line); border-radius: 10px; padding: 0.35rem; background: rgba(239, 248, 255, 0.92); }
.chart-wrap svg { width: 100%; height: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.45rem; }
.chart-legend-item { display: inline-flex; align-items: center; gap: 0.32rem; border: 1px solid var(--line); border-radius: 12px; padding: 0.18rem 0.45rem; font-size: 0.72rem; color: #1f4961; background: #ffffff; }
.chart-legend-item i { width: 10px; height: 10px; display: inline-block; border-radius: 50%; }
.readiness-card h3 { margin: 0; font-size: 1.02rem; }
.readiness-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.55rem; }
.readiness-list { display: grid; gap: 0.55rem; }
.readiness-row { display: grid; gap: 0.28rem; padding: 0.45rem 0.5rem; border: 1px solid var(--line); border-radius: 9px; background: rgba(243, 250, 255, 0.82); }
.readiness-meta { display: flex; justify-content: space-between; align-items: center; gap: 0.45rem; font-size: 0.78rem; }
.readiness-meta strong { color: #1d4a62; }
.readiness-meta span { color: #395f74; font-weight: 700; }
.readiness-bar { width: 100%; height: 8px; background: rgba(117, 154, 175, 0.2); border-radius: 999px; overflow: hidden; }
.readiness-bar i { display: block; height: 100%; border-radius: 999px; }
.dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; align-items: start; }
.queue-card table { min-width: 100%; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.55rem; }
.action-card { border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem; background: rgba(241, 250, 255, 0.96); display: grid; gap: 0.4rem; }
.action-card h4 { margin: 0; font-size: 0.9rem; line-height: 1.25; color: #1f4b66; }
.action-card p { margin: 0; font-size: 0.77rem; line-height: 1.35; color: var(--muted); min-height: 34px; }
.dashboard-tail { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.dashboard-tail .card h3 { margin-top: 0; font-size: 1.01rem; letter-spacing: 0.01em; }
.dashboard-tail .card, .dashboard-main-row .card, .dashboard-row .card { height: 100%; }
.risk-surface-list { display: grid; gap: 0.5rem; }
.risk-surface-list { max-height: 290px; overflow: auto; padding-right: 2px; }
.risk-surface-row { border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.55rem; background: rgba(246, 253, 255, 0.96); display: grid; gap: 0.28rem; }
.risk-surface-meta { display: flex; justify-content: space-between; align-items: center; gap: 0.45rem; font-size: 0.76rem; }
.risk-surface-meta strong { color: #1f4b66; }
.risk-surface-meta span { color: #2f546b; font-weight: 700; }
.risk-surface-bar { width: 100%; height: 9px; border-radius: 999px; background: rgba(126, 161, 186, 0.25); overflow: hidden; }
.risk-surface-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #18b58a, #2aa6f6); }
.risk-surface-row.high .risk-surface-bar i { background: linear-gradient(90deg, #ff6363, #ff8f53); }
.risk-surface-row.medium .risk-surface-bar i { background: linear-gradient(90deg, #f6aa2b, #f16f2b); }
.risk-surface-row.low .risk-surface-bar i { background: linear-gradient(90deg, #14b886, #2aa6f6); }
.risk-surface-stats { display: flex; gap: 0.5rem; font-size: 0.72rem; color: #3e6177; }
.risk-item-list { display: grid; gap: 0.55rem; }
.risk-item-list { max-height: 290px; overflow: auto; padding-right: 2px; }
.risk-item { border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem 0.65rem; background: #ffffff; display: grid; gap: 0.24rem; }
.risk-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.risk-item h4 { margin: 0; font-size: 0.9rem; line-height: 1.25; color: #1f4b66; }
.risk-item p { margin: 0; font-size: 0.75rem; line-height: 1.35; color: var(--muted); }
.risk-item-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.71rem; color: #35596f; }
.risk-chip { border-radius: 999px; padding: 0.22rem 0.5rem; font-size: 0.76rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.risk-chip.high { color: #b62323; background: #ffe5e5; border-color: #f2b0b0; }
.risk-chip.medium { color: #9f5f00; background: #fff0d7; border-color: #edcc91; }
.risk-chip.low { color: #0d7f5d; background: #dcf8ef; border-color: #9adcc6; }
.insight-grid { display: grid; gap: 0.55rem; }
.insight-grid { max-height: 290px; overflow: auto; padding-right: 2px; }
.readiness-list { max-height: 290px; overflow: auto; padding-right: 2px; }
.action-grid { max-height: 290px; overflow: auto; padding-right: 2px; }
.queue-card .table-wrap { max-height: 290px; overflow: auto; }
.insight-tile { border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem 0.65rem; background: rgba(246, 252, 255, 0.98); display: grid; gap: 0.22rem; }
.insight-tile h4 { margin: 0; font-size: 0.88rem; line-height: 1.25; color: #1f4b66; }
.insight-tile p { margin: 0; font-size: 0.75rem; line-height: 1.35; color: #385b70; }

.queue-card th, .queue-card td { font-size: 0.76rem; }
.queue-card th { letter-spacing: 0.01em; }
.insight-tile span { font-size: 0.72rem; font-weight: 700; }
.insight-tile.high span { color: #d23f3f; }
.insight-tile.medium span { color: #b27f19; }
.insight-tile.opportunity span { color: #1a8f68; }
@media (max-width: 1200px) { .dashboard-main-row { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .dashboard-row, .dashboard-hero, .dashboard-tail { grid-template-columns: 1fr; } .hero-actions { justify-content: flex-start; } }
@media (pointer: coarse) {
  .btn, .menu-item, input, select, textarea { min-height: 44px; }
  .row-actions button, .link-btn { min-height: 40px; }
}
