:root {
  --blue: #62a5c0;
  --blue-dark: #39708a;
  --blue-deep: #28576b;
  --blue-soft: #eaf3f7;
  --ink: #28383f;
  --muted: #6c7d86;
  --line: #dfe8ec;
  --surface: #ffffff;
  --canvas: #f3f6f8;
  --good: #24764c;
  --good-bg: #e5f3ea;
  --warn: #9b6812;
  --warn-bg: #fcf2dd;
  --bad: #b84844;
  --bad-bg: #f9e7e6;
  --shadow: 0 12px 35px rgba(39, 74, 89, 0.09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: 244px; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--surface); box-shadow: 8px 0 30px rgba(35, 67, 80, .03); overflow-y: auto;
}
.brand { display: flex; align-items: center; padding: 21px 20px 18px; color: var(--blue-dark); text-decoration: none; }
.brand img { display: block; width: 182px; height: auto; }
.nav-label { padding: 17px 20px 7px; color: #8a989f; font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.nav { display: grid; gap: 3px; padding: 0 10px; }
.nav a { display: flex; min-height: 42px; align-items: center; gap: 10px; padding: 0 12px; border-radius: 9px; color: #52636b; font-size: 13.5px; font-weight: 600; text-decoration: none; }
.nav a:hover { background: #f3f8fa; color: var(--blue-dark); }
.nav a.active { background: var(--blue-soft); color: var(--blue-deep); font-weight: 750; }
.nav-icon { width: 20px; color: var(--blue-dark); text-align: center; font-size: 18px; }
.live-dot { width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: #35a267; box-shadow: 0 0 0 4px #e5f3ea; }
.sidebar-spacer { flex: 1; }
.user-card { display: flex; align-items: center; gap: 10px; margin: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfd; }
.user-card > div:nth-child(2) { min-width: 0; flex: 1; }
.user-card strong, .user-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card strong { font-size: 12.5px; }
.user-card small { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: var(--blue-dark); color: white; font-size: 12px; font-weight: 800; }
.icon-button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--muted); cursor: pointer; }
.icon-button:hover { border-color: var(--blue); color: var(--blue-dark); }

.main { min-width: 0; flex: 1; margin-left: 244px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; min-height: 74px; align-items: center; gap: 16px; padding: 13px 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.topbar p { margin: 0 0 2px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .8px; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.25px; }
.top-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; color: var(--muted); font-size: 12px; }
.mobile-menu { display: none; }
.page { width: 100%; max-width: 1480px; padding: 26px 28px 52px; }
.notice { position: fixed; z-index: 50; top: 84px; right: 24px; max-width: 440px; padding: 13px 17px; border: 1px solid #b8dfc9; border-radius: 10px; background: #edf8f2; color: #245f40; box-shadow: var(--shadow); font-size: 13px; }
.notice.error { border-color: #efc6c4; background: #fff1f0; color: #8d3430; }
.loading-card { padding: 36px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--muted); text-align: center; }

.hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; padding: 25px 27px; overflow: hidden; border-radius: 16px; background: linear-gradient(125deg, var(--blue-deep), #4d8ba6); color: white; box-shadow: var(--shadow); }
.hero::after { width: 180px; height: 180px; margin: -100px -35px -100px 0; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; box-shadow: 0 0 0 32px rgba(255,255,255,.04), 0 0 0 65px rgba(255,255,255,.03); content: ""; }
.hero h2 { margin: 0 0 7px; font-size: 23px; letter-spacing: -.4px; }
.hero p { max-width: 700px; margin: 0; color: #d6e7ee; line-height: 1.55; }
.hero-content { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 10.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 28px 1px 11px; }
.section-heading h2 { margin: 0; font-size: 15px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.kpi { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 4px 15px rgba(37, 70, 85, .025); }
.kpi .label { min-height: 30px; color: var(--muted); font-size: 11.5px; font-weight: 650; line-height: 1.35; }
.kpi .value { margin-top: 7px; overflow: hidden; font-size: 24px; font-weight: 780; letter-spacing: -.55px; text-overflow: ellipsis; white-space: nowrap; }
.kpi .value small { color: var(--muted); font-size: 12px; font-weight: 550; }
.kpi .meta { margin-top: 6px; color: var(--muted); font-size: 11px; }
.kpi.accent { border-color: transparent; background: var(--blue-dark); color: white; }
.kpi.accent .label, .kpi.accent .meta, .kpi.accent .value small { color: #d4e7ef; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card { border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 5px 20px rgba(37, 70, 85, .035); }
.card-header { display: flex; min-height: 53px; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 17px; border-bottom: 1px solid var(--line); }
.card-header h2, .card-header h3 { margin: 0; font-size: 14px; }
.card-body { padding: 17px; }
.module-card { display: flex; min-height: 185px; flex-direction: column; padding: 19px; }
.module-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.module-icon { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 10px; background: var(--blue-soft); color: var(--blue-dark); font-size: 19px; }
.module-card h3 { margin: 17px 0 6px; font-size: 16px; }
.module-card p { margin: 0 0 17px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.module-card .module-footer { display: flex; align-items: center; margin-top: auto; }
.text-link { color: var(--blue-dark); font-size: 12px; font-weight: 750; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.badge { display: inline-flex; min-height: 23px; align-items: center; padding: 2px 9px; border-radius: 12px; font-size: 10px; font-weight: 800; letter-spacing: .15px; white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: #edf1f3; color: #697a82; }

.tabs { display: flex; gap: 4px; width: max-content; max-width: 100%; margin-bottom: 16px; padding: 4px; overflow-x: auto; border-radius: 10px; background: #e8f1f5; }
.tabs button { padding: 8px 15px; border: 0; border-radius: 7px; background: transparent; color: #5d6d75; cursor: pointer; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.tabs button.active { background: white; color: var(--blue-deep); box-shadow: 0 1px 4px rgba(40, 71, 84, .15); }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; background: #f8fafb; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfdfe; }
.number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.strong { font-weight: 750; }
.muted { color: var(--muted); }
.low { color: var(--bad); font-weight: 750; }
.empty { padding: 34px 18px !important; color: var(--muted); text-align: center; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar input { max-width: 310px; }
.toolbar .spacer { flex: 1; }
.button { min-height: 38px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--blue-deep); cursor: pointer; font-size: 12.5px; font-weight: 750; }
.button:hover { border-color: var(--blue); background: var(--blue-soft); }
.button.primary { border-color: var(--blue-dark); background: var(--blue-dark); color: white; }
.button.primary:hover { border-color: var(--blue-deep); background: var(--blue-deep); }
.button.danger { color: var(--bad); }
.button.small { min-height: 30px; padding: 5px 9px; font-size: 11px; }
.button.wide { width: 100%; }
.button:disabled { cursor: wait; opacity: .55; }

.form-card { max-width: 1120px; }
.form-section { padding: 18px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section h3 { margin: 0 0 14px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: 5px; color: var(--muted); font-size: 11.5px; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid #cedae0; border-radius: 8px; outline: 0; background: white; color: var(--ink); font-size: 12.5px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(98, 165, 192, .13); }
.line-items { display: grid; gap: 9px; }
.line-item { display: grid; grid-template-columns: minmax(210px, 2fr) repeat(5, minmax(90px, .7fr)) 38px; gap: 8px; align-items: end; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fafcfd; }
.line-item.withdraw { grid-template-columns: minmax(240px, 2fr) minmax(130px, .8fr) 38px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 18px; background: #fbfcfd; }
.form-hint { margin: 0 0 14px; padding: 11px 13px; border: 1px solid #cee2ea; border-radius: 9px; background: var(--blue-soft); color: var(--blue-deep); font-size: 12px; line-height: 1.5; }
.form-error { min-height: 18px; margin-top: 9px; color: var(--bad); font-size: 12px; }
.winp { width: 110px; min-height: 32px; padding: 5px 8px; text-align: right; }

.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.calendar-weekdays { margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .5px; text-align: center; text-transform: uppercase; }
.calendar-day { min-height: 130px; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.calendar-day.empty-day { border-style: dashed; background: transparent; opacity: .35; }
.calendar-date { margin-bottom: 8px; font-size: 12px; font-weight: 800; }
.calendar-people { display: grid; gap: 4px; }
.person-chip { overflow: hidden; padding: 4px 7px; border: 0; border-radius: 7px; background: var(--blue-soft); color: var(--blue-deep); cursor: pointer; font-size: 10.5px; font-weight: 700; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.person-chip.on-call { background: var(--warn-bg); color: var(--warn); }
.calendar-add { margin-top: 7px; }
.calendar-add select { min-height: 29px; padding: 4px 6px; font-size: 10.5px; }
.tabs.compact { margin: 0; }
.tabs.compact button { padding: 8px 12px; }
.meter-chart { width: 100%; overflow-x: auto; }
.meter-chart svg { display: block; min-width: 720px; width: 100%; }
.meter-chart text { fill: var(--muted); font-size: 11px; }
.meter-chart .chart-grid { stroke: var(--line); stroke-width: 1; }
.meter-chart .chart-line { fill: none; stroke: var(--blue); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.meter-chart circle { fill: var(--blue); stroke: white; stroke-width: 2; }
.approval-alert { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 16px; padding: 14px 18px; border: 1px solid #ead49d; border-radius: 12px; background: #fff8e8; color: #6f5211; text-decoration: none; }
.approval-alert span { font-size: 12px; }
.revenue-chart { width: 100%; overflow-x: auto; }
.revenue-chart svg { display: block; min-width: 680px; width: 100%; }
.revenue-chart rect { fill: var(--blue); }
.revenue-chart line { stroke: var(--line); }
.revenue-chart text { fill: var(--muted); font-size: 11px; }
.banner-preview { display: flex; align-items: center; gap: 16px; min-height: 92px; margin: 18px 0; padding: 18px; border-radius: 14px; color: white; background: var(--blue); overflow: hidden; }
.banner-preview.theme-dark { background: #24333d; }
.banner-preview.theme-amber { background: #b27a12; }
.banner-preview img { width: 130px; height: 72px; object-fit: cover; border-radius: 8px; }
.banner-preview div { display: flex; flex-direction: column; gap: 5px; }
.banner-preview strong { font-size: 17px; }
.banner-preview span, .banner-preview small { opacity: .9; }

.integration-list { display: grid; gap: 11px; }
.integration-row { display: grid; grid-template-columns: 1.3fr .8fr .8fr 1.2fr; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.integration-row strong, .integration-row small { display: block; }
.integration-row small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.contract { padding: 12px 14px; border-radius: 8px; background: #253a43; color: #d9e9ef; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; overflow-wrap: anywhere; }
.timeline { display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-mark { width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.timeline-item p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.timeline-item time { color: var(--muted); font-size: 10.5px; }

.login-screen { position: relative; display: grid; min-height: 100vh; place-items: center; overflow: hidden; padding: 24px; background: linear-gradient(145deg, #eef5f8 0%, #f8fafb 48%, #e5f0f4 100%); }
.login-screen::before, .login-screen::after { position: absolute; border: 1px solid rgba(98,165,192,.2); border-radius: 50%; content: ""; pointer-events: none; }
.login-screen::before { width: 520px; height: 520px; top: -290px; right: -120px; box-shadow: 0 0 0 65px rgba(98,165,192,.04), 0 0 0 130px rgba(98,165,192,.025); }
.login-screen::after { width: 360px; height: 360px; bottom: -240px; left: -80px; box-shadow: 0 0 0 55px rgba(98,165,192,.035); }
.login-card { position: relative; z-index: 1; width: 100%; max-width: 430px; padding: 42px 42px 36px; border: 1px solid rgba(98,165,192,.25); border-radius: 26px; background: rgba(255,255,255,.96); box-shadow: 0 28px 85px rgba(38,75,91,.16); backdrop-filter: blur(14px); }
.login-logo { display: block; width: min(260px, 82%); height: auto; margin: 0 auto; }
.login-card h1 { margin: 35px 0 25px; color: var(--ink); font-size: 24px; letter-spacing: -.35px; text-align: center; }
.login-fields { display: grid; gap: 15px; margin-bottom: 22px; }
.login-card label { gap: 7px; color: #546971; font-size: 12px; }
.login-card input { min-height: 47px; padding: 11px 13px; border-color: #cbdce3; border-radius: 11px; background: #fbfdfe; font-size: 14px; }
.login-card .button { min-height: 47px; border-radius: 11px; font-size: 14px; }
.login-card .form-error { margin-top: 10px; text-align: center; }
.registration-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .75fr); gap: 16px; align-items: start; }
.registration-summary { position: sticky; top: 92px; }
.permission-note { display: flex; gap: 11px; align-items: flex-start; padding: 13px; border: 1px solid #cfe2ea; border-radius: 10px; background: var(--blue-soft); color: var(--blue-deep); font-size: 12px; line-height: 1.5; }
.permission-note strong { display: block; margin-bottom: 2px; }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .line-item { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .line-item > label:first-child { grid-column: span 2; }
}

@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.menu-open .sidebar { transform: translateX(0); }
  .main { margin-left: 0; }
  .mobile-menu { display: grid; }
  .topbar { min-height: 66px; padding: 10px 15px; }
  .top-actions #clock { display: none; }
  .page { padding: 18px 14px 40px; }
  .hero { padding: 21px; }
  .hero::after { display: none; }
  .hero h2 { font-size: 20px; }
  .kpi-grid, .card-grid, .form-grid, .form-grid.three, .form-grid.two { grid-template-columns: 1fr; }
  .line-item, .line-item.withdraw { grid-template-columns: 1fr 38px; }
  .line-item > label, .line-item > label:first-child { grid-column: 1; }
  .line-item > button { grid-column: 2; grid-row: 1; }
  .integration-row { grid-template-columns: 1fr 1fr; }
  .calendar-weekdays { display: none; }
  .calendar-grid { grid-template-columns: 1fr; }
  .calendar-day.empty-day { display: none; }
  .calendar-day { min-height: 90px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar input { max-width: none; }
  .login-card { max-width: 400px; padding: 34px 24px 28px; border-radius: 22px; }
  .login-screen::before { right: -330px; }
  .registration-layout { grid-template-columns: 1fr; }
  .registration-summary { position: static; }
}
