:root {
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #20233a;
  background: #f6f7fc;
  font-synthesis: none;
  --paper: #fff;
  --ink: #20233a;
  --muted: #62687d;
  --soft: #f5f5fb;
  --line: #e6e8f2;
  --brand: #5844ce;
  --brand-dark: #4433b3;
  --brand-light: #efedff;
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
h1, h2, h3, p { margin: 0; }
a { color: var(--brand-dark); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
svg { display: inline-block; width: 20px; height: 20px; flex: none; }
svg:has(> use) { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.shell { min-height: 100dvh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 23px 16px 18px; background: var(--paper); border-right: 1px solid var(--line); z-index: 3; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 0 33px 9px; width: max-content; color: var(--ink); font-size: 1.125rem; font-weight: 750; letter-spacing: -.045em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #fff; background: var(--brand); box-shadow: 0 5px 12px #5542ca34; }
.brand-mark svg { height: 22px; width: 22px; }
.brand-accent { color: var(--brand); }
.navigation { display: grid; gap: 5px; }
.navigation a { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 10px; color: #4e556c; font-weight: 600; font-size: .9375rem; white-space: nowrap; }
.navigation a:hover { background: var(--soft); color: var(--ink); }
.navigation a[aria-current] { background: var(--brand-light); color: var(--brand-dark); }
.navigation a svg { width: 19px; height: 19px; }
.nav-count { margin-left: auto; min-width: 21px; padding: 1px 5px; border-radius: 5px; background: #e9e6fa; color: var(--brand-dark); font-size: .75rem; text-align: center; font-weight: 700; }
.nav-alert { background: #fff0db; color: #8c571a; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--line); padding: 17px 7px 0; display: flex; align-items: center; gap: 10px; }
.sidebar-footer strong { display: block; font-size: .875rem; }
.sidebar-footer small { display: block; margin-top: 3px; color: var(--muted); font-size: .8125rem; }
.profile { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; color: var(--brand); background: var(--brand-light); }
.profile svg { width: 17px; height: 17px; }

.workspace { min-width: 0; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 max(26px, calc((100% - 1256px) / 2)); background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-label { font-size: .9375rem; font-weight: 600; color: var(--muted); margin-right: auto; }
.topbar-actions { display: flex; align-items: center; gap: 19px; }
.today { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .875rem; white-space: nowrap; }
.today svg { width: 17px; height: 17px; }
.menu { display: none !important; }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; border: 1px solid transparent; border-radius: 9px; padding: 7px 12px; background: var(--paper); color: var(--ink); font-weight: 650; font-size: .875rem; line-height: 1.2; white-space: nowrap; transition: color .15s, background .15s, border-color .15s; }
.button svg, .icon-button svg { width: 18px; height: 18px; }
.icon-button { width: 38px; padding: 0; color: var(--muted); }
.icon-button:hover, .button.subtle:hover { background: var(--soft); }
.button.primary { color: white; background: var(--brand); border-color: var(--brand); box-shadow: 0 3px 8px #5844ce24; }
.button.primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.button.outline { border-color: #dedfee; }
.button.outline:hover { border-color: #b7acef; background: #f8f7ff; color: var(--brand-dark); }
.button.subtle { color: var(--brand-dark); background: #f5f4ff; }
.button.danger { background: #fff3f5; color: #962744; border-color: #efcdd6; }
.button.danger:hover { background: #fce4e9; }
.button.danger-solid { background: #a62f4e; border-color: #a62f4e; color: #fff; }
.button.danger-solid:hover { background: #89233e; }
.trash-details { display: grid; gap: 12px; line-height: 1.45; }
.assistant-button { color: var(--brand-dark); background: var(--brand-light); }
.assistant-button:hover { background: #e6e1fd; }

.auth-screen { max-width: none; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(ellipse at 50% 0%, #ebe7ff, #f6f7fc 62%); }
.auth-card { width: min(100%, 430px); padding: clamp(22px, 6vw, 34px); background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 16px 50px #36276914; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 25px; font-size: 1.05rem; font-weight: 750; letter-spacing: -.04em; }
.auth-card h1 { font-size: 1.7rem; line-height: 1.14; letter-spacing: -.045em; }
.auth-card > p { margin-top: 8px; color: var(--muted); line-height: 1.45; }
.auth-form { display: grid; gap: 13px; margin-top: 21px; }
.auth-form label { display: grid; gap: 5px; color: #4c5369; font-size: .875rem; font-weight: 650; }
.auth-form input { width: 100%; min-height: 43px; font-weight: 400; }
.auth-form .button { min-height: 43px; margin-top: 2px; }
.auth-form .form-error:empty { display: none; }
.auth-card > .button { margin-top: 16px; }
.sidebar-footer small { overflow-wrap: anywhere; }

main { max-width: 1310px; margin: 0 auto; padding: 31px 27px 42px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 23px; }
.page-heading h1 { font-size: clamp(2rem, 3.4vw, 2.55rem); font-weight: 750; letter-spacing: -.058em; line-height: 1.05; }
.page-heading p { margin-top: 8px; color: var(--muted); line-height: 1.4; }
.page-heading .primary { min-height: 42px; padding: 8px 14px; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 16px; }
.metric, .panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 2px 3px #17163804; }
.metric { padding: 15px 16px 16px; }
.metric-top { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; font-weight: 650; color: #4f556c; font-size: .875rem; }
.metric-icon, .panel-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; flex: none; background: var(--brand-light); color: var(--brand); }
.metric-icon svg, .panel-icon svg { width: 18px; height: 18px; }
.metric-icon.green { background: #e6f6ee; color: #187657; }
.metric-icon.blue { background: #e9f1fe; color: #325eaf; }
.metric-icon.amber { background: #fff2d8; color: #a06916; }
.metric strong { display: block; font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.1; font-weight: 750; letter-spacing: -.045em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.metric-note { margin-top: 6px; display: block; color: var(--muted); font-size: .8125rem; line-height: 1.35; }
.overview-grid, .report-grid { display: grid; grid-template-columns: 1.65fr 1fr; gap: 16px; margin-bottom: 16px; }
.report-grid { margin-top: 16px; grid-template-columns: 1.3fr 1fr; }
.panel-heading { padding: 16px 18px 14px; display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.panel h2 { font-size: 1.125rem; line-height: 1.25; font-weight: 700; letter-spacing: -.025em; }
.panel-heading p { margin-top: 4px; color: var(--muted); font-size: .875rem; }
.text-link { display: inline-flex; align-items: center; align-self: center; gap: 3px; font-size: .875rem; font-weight: 650; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }
.text-link svg { width: 14px; height: 14px; }
.plot { position: relative; padding: 0 18px 13px; }
.plot svg { display: block; width: 100%; height: auto; max-height: 148px; overflow: visible; }
.chart-grid { stroke: #e9e9f4; stroke-dasharray: 4 5; vector-effect: non-scaling-stroke; }
.chart-bar { fill: #6f60dc; }
.chart-empty { position: absolute; inset: 0 15px 25px; display: grid; place-items: center; text-align: center; font-size: .875rem; color: #596079; }
.chart-dates { display: flex; justify-content: space-between; color: var(--muted); font-size: .8125rem; }
.stage-list { display: grid; gap: 14px; padding: 4px 18px 18px; }
.stage-row { display: grid; grid-template-columns: minmax(98px, auto) minmax(20px, 1fr) 20px; gap: 12px; align-items: center; font-size: .875rem; }
.stage-name { display: flex; align-items: center; gap: 8px; }
.stage-name i { background: var(--stage); width: 8px; height: 8px; border-radius: 50%; }
.stage-row strong { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.stage-new { --stage: #5679df; }
.stage-assigned { --stage: #8064d3; }
.stage-working { --stage: #2a8e71; }
.stage-rescheduled { --stage: #d48a32; }
meter { width: 100%; height: 8px; appearance: none; }
meter::-webkit-meter-bar { background: #efeff7; border: none; border-radius: 12px; }
meter::-webkit-meter-optimum-value { background: var(--stage); border-radius: 12px; }
meter::-moz-meter-bar { background: var(--stage); }

.empty { display: grid; justify-items: center; text-align: center; padding: 30px 18px 34px; }
.empty-icon { display: grid; place-items: center; border-radius: 14px; width: 46px; height: 46px; background: var(--brand-light); color: var(--brand); margin-bottom: 11px; }
.empty h3 { font-size: 1rem; font-weight: 700; }
.empty p { color: var(--muted); font-size: .875rem; max-width: 380px; margin-top: 4px; }
.empty .button { margin-top: 12px; }
.order-panel .empty { border-top: 1px solid var(--line); }
.table-wrap { position: relative; overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
table { width: 100%; border-collapse: collapse; table-layout: auto; text-align: left; font-size: .875rem; }
th { padding: 11px 13px; background: #f7f7fc; color: #545b72; font-weight: 650; border-block: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 13px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
tr:last-child td { border-bottom: none; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
tr[data-action] { cursor: pointer; }
tr[data-action]:hover { background: #faf9ff; }
.orders-table { min-width: 740px; }
.order-link { color: var(--brand-dark); border: 0; background: none; padding: 0; font-weight: 750; font-size: .9375rem; }
.order-link:hover { text-decoration: underline; }
.table-main { display: block; font-weight: 650; }
.table-secondary { display: block; color: var(--muted); margin-top: 3px; font-size: .8125rem; }
.service { max-width: 230px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.kind-tag { display: inline-block; margin-top: 3px; color: #5c438e; font-size: .8125rem; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 20px; padding: 4px 8px; font-weight: 650; font-size: .8125rem; white-space: nowrap; color: #3e548a; background: #e9efff; }
.badge span { width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.status-assigned { color: #5e45a9; background: #efeafe; }
.status-working { color: #136950; background: #def5eb; }
.status-rescheduled { color: #8c571a; background: #fff0db; }
.status-closed { color: #146145; background: #e7f3ec; }
.status-cancelled { color: #914154; background: #fbeaf0; }
.status-active { color: #146145; background: #e7f3ec; }
.status-soon { color: #8c571a; background: #fff0db; }
.status-due, .status-overdue { color: #914154; background: #fbeaf0; }
.vpn-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vpn-table { min-width: 690px; }
.vpn-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.vpn-columns label { display: grid; gap: 5px; font-size: .875rem; font-weight: 650; color: #4c5369; }
.assignee { display: inline-flex; gap: 7px; align-items: center; }
.avatar { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--brand-light); color: var(--brand-dark); font-weight: 700; font-size: .8125rem; }
.amount { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 650; }
.row-go { color: var(--muted); width: 32px; }
.row-go svg { width: 15px; height: 15px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; padding: 15px 17px; }
.search-filters { display: flex; flex-wrap: wrap; gap: 9px; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: #f4f4fa; border-radius: 9px; }
.segmented button { border: 1px solid transparent; background: transparent; border-radius: 7px; padding: 6px 9px; color: var(--muted); font-size: .875rem; font-weight: 650; }
.segmented button[aria-pressed="true"] { border-color: #e3e1f0; background: var(--paper); color: var(--brand-dark); }

input, select, textarea { min-width: 0; background: var(--paper); border: 1px solid #dcdfee; border-radius: 8px; color: var(--ink); padding: 8px 10px; min-height: 39px; font-size: .9375rem; }
select { appearance: none; padding-right: 28px; background: linear-gradient(45deg, transparent 50%, #666985 50%) right 13px center / 5px 5px no-repeat, linear-gradient(135deg, #666985 50%, transparent 50%) right 8px center / 5px 5px no-repeat, var(--paper); }
input:focus, select:focus, textarea:focus { outline: 2px solid #b5aaf6; outline-offset: 0; border-color: var(--brand); }
input::placeholder, textarea::placeholder { color: #74798f; }
textarea { resize: vertical; line-height: 1.45; }
.search { position: relative; color: var(--muted); }
.search svg { position: absolute; top: 11px; left: 10px; width: 17px; height: 17px; pointer-events: none; }
.search input { width: 227px; padding-left: 33px; }
.date-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.date-form label { display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: .875rem; }

dialog { border: 0; padding: 0; color: var(--ink); box-shadow: 0 12px 60px #1e173b40; }
dialog::backdrop { background: #25213e65; }
.drawer { max-width: 100vw; max-height: 100dvh; width: min(600px, 100vw); height: 100dvh; margin: 0 0 0 auto; border-radius: 16px 0 0 16px; }
.drawer[open] { display: flex; flex-direction: column; }
.drawer-header { display: flex; gap: 12px; align-items: flex-start; padding: 17px 21px; justify-content: space-between; border-bottom: 1px solid var(--line); flex: none; }
.drawer-header h2 { letter-spacing: -.035em; font-size: 1.45rem; line-height: 1.4; }
.drawer-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; color: var(--muted); font-size: .875rem; }
.drawer-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.drawer-body { padding: 17px 21px 23px; overflow-y: auto; flex: 1; }
.drawer-footer { flex: none; border-top: 1px solid var(--line); padding: 12px 21px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.drawer-footer > div { display: flex; align-items: center; gap: 8px; }
.form-section { padding: 0 0 19px; margin-bottom: 17px; border-bottom: 1px solid var(--line); }
.form-section h3 { font-size: 1.05rem; margin-bottom: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid label, .modal-body > label { display: grid; gap: 5px; font-size: .875rem; font-weight: 650; color: #4c5369; }
.full { grid-column: 1 / -1; }
label.check { display: flex; gap: 8px; align-items: center; }
.check input { min-height: auto; width: 17px; height: 17px; accent-color: var(--brand); }
.allocation { background: #f6f4ff; border: 1px solid #efebfb; border-radius: 10px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 12px; }
.allocation span { font-size: .8125rem; color: #5b5480; }
.allocation strong { display: block; font-size: 1rem; margin-top: 3px; color: var(--ink); }
.notice { padding: 8px; border-radius: 8px; color: #634b14; background: #fff4dd; font-size: .875rem; }
.notice .button { min-height: 29px; margin-left: 5px; padding: 3px 5px; background: #fffaf0; }
.order-shortcuts, .related > div { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.related > div { margin-bottom: 0; }
.activity { padding: 10px 0; font-size: .875rem; }
.activity summary { cursor: pointer; color: var(--brand-dark); font-weight: 650; }
.activity summary span { margin-left: 6px; color: var(--muted); font-weight: 400; }
.activity ol { list-style: none; padding: 0; }
.activity ol > li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.activity ol > li > span { font-size: .8125rem; color: var(--muted); }
.activity ul { padding-left: 16px; }
.activity pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; padding: 8px; background: var(--soft); border-radius: 8px; }
.activity del { color: var(--muted); }
.form-error { color: #a02043; font-size: .875rem; }
.modal { width: min(430px, calc(100% - 24px)); border-radius: 14px; }
.modal-body { padding: 18px 21px; display: grid; gap: 13px; }

.chat-drawer { width: min(530px, 100vw); }
.assistant-heading { display: flex; align-items: center; gap: 10px; }
.assistant-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--brand); background: var(--brand-light); }
.assistant-heading #chat-mode { color: var(--muted); font-size: .8125rem; }
.messages { flex: 1; min-height: 0; overflow: auto; padding: 18px 18px; display: flex; flex-direction: column; gap: 10px; background: #faf9fd; }
.message { max-width: min(100%, 430px); flex: none; padding: 11px 13px; border-radius: 13px; font-size: .9375rem; line-height: 1.4; }
.message p { white-space: pre-wrap; overflow-wrap: anywhere; }
.message.bot { align-self: flex-start; border: 1px solid var(--line); background: var(--paper); border-bottom-left-radius: 4px; }
.message.you { align-self: flex-end; background: var(--brand-light); color: #342d63; border-bottom-right-radius: 4px; }
.message.waiting { color: var(--muted); }
.chat-actions { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.chat-actions .button { min-height: 33px; font-size: .8125rem; white-space: normal; }
.chat-form { display: flex; padding: 10px 15px; gap: 8px; align-items: flex-end; border-top: 1px solid var(--line); }
.chat-form textarea { flex: 1; max-height: 40dvh; }
.chat-send { min-width: 42px; min-height: 40px; padding: 8px; }
.toast { position: fixed; z-index: 10; bottom: 18px; right: 18px; max-width: calc(100% - 36px); background: #302952; color: #fff; padding: 11px 14px; border-radius: 9px; font-size: .875rem; box-shadow: 0 5px 16px #20144236; }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 185px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
  .topbar { padding-inline: 17px; }
  main { padding-inline: 17px; }
  .metric { padding-inline: 12px; }
  .stage-row { gap: 7px; }
}

@media (max-width: 800px) {
  .shell { display: block; }
  .sidebar { display: none; position: fixed; left: 0; top: 55px; width: 224px; height: calc(100dvh - 55px); box-shadow: 12px 0 20px #29224a1e; }
  .nav-open .sidebar { display: flex; }
  .topbar { height: 55px; gap: 8px; }
  .menu { display: inline-flex !important; margin-left: -6px; }
  .topbar-actions { gap: 9px; }
  .brand { margin-bottom: 19px; }
  main { padding-top: 23px; }
}

@media (max-width: 580px) {
  .topbar, main { padding-inline: 11px; }
  .today { display: none; }
  .page-heading { align-items: flex-start; margin-bottom: 15px; }
  .page-heading p { font-size: .875rem; }
  .page-heading .primary { min-height: 38px; padding-inline: 9px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .vpn-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .vpn-metrics .metric-top { flex-wrap: wrap; }
  .metric-top { gap: 6px; }
  .metric-icon { width: 28px; height: 28px; }
  .overview-grid, .report-grid { grid-template-columns: 1fr; gap: 10px; }
  .drawer { border-radius: 0; }
  .drawer-body, .drawer-header, .drawer-footer { padding-inline: 12px; }
  .drawer-footer { flex-wrap: wrap; }
  .segmented { row-gap: 1px; }
  .filters { padding-inline: 10px; }
}
