:root {
  --ink: #111827;
  --muted: #697386;
  --line: #e7eaf0;
  --paper: #ffffff;
  --canvas: #f5f6fa;
  --purple: #6255e7;
  --purple-deep: #493bd1;
  --purple-soft: #eeecff;
  --green: #168461;
  --green-soft: #e8f7f1;
  --amber: #ae6b08;
  --amber-soft: #fff4dc;
  --red: #c14343;
  --red-soft: #fff0f0;
  --shadow: 0 18px 50px rgba(17, 24, 39, .08);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0 0 8px; color: var(--purple); font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: .13em; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, .86fr) 1.14fr; background: var(--paper); }
.login-panel { width: min(440px, calc(100% - 64px)); margin: auto; padding: 48px 0; }
.brand-mark { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 42px; border-radius: 18px; color: white; background: linear-gradient(145deg, #776af1, #493bd1); box-shadow: 0 14px 28px rgba(98, 85, 231, .28); font: 800 28px/1 Georgia, serif; }
.brand-mark.small { width: 36px; height: 36px; margin: 0; border-radius: 11px; font-size: 19px; box-shadow: none; }
.login-panel h1 { max-width: 420px; margin: 0; font-size: clamp(40px, 5vw, 62px); line-height: .98; letter-spacing: -.05em; }
.login-copy { max-width: 390px; margin: 24px 0 32px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.google-button { min-height: 44px; }
.login-status { min-height: 22px; margin: 13px 0 0; color: var(--muted); font-size: 13px; }
.login-status.error { color: var(--red); }
.security-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 38px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.security-note span { color: var(--green); }
.security-note code { padding: 2px 5px; border-radius: 5px; background: var(--canvas); color: #4b5563; }
.login-visual { position: relative; min-height: 100vh; overflow: hidden; background: radial-gradient(circle at 72% 25%, rgba(141, 127, 255, .75), transparent 28%), radial-gradient(circle at 24% 80%, rgba(72, 56, 199, .78), transparent 31%), linear-gradient(135deg, #17152f, #292254 56%, #151329); }
.visual-orbit { position: absolute; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; }
.orbit-one { width: 620px; height: 620px; top: -150px; right: -180px; }
.orbit-two { width: 430px; height: 430px; left: -80px; bottom: -150px; }
.visual-card { position: absolute; display: flex; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.1); color: white; box-shadow: 0 30px 80px rgba(0,0,0,.22); backdrop-filter: blur(16px); }
.visual-card-top { top: 22%; left: 17%; width: 270px; padding: 28px; flex-direction: column; border-radius: 24px; transform: rotate(-4deg); }
.visual-card-top strong { margin: 16px 0 8px; font-size: 44px; letter-spacing: -.05em; }
.mini-label { color: #d7d2ff; font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.trend { color: #d9d7ec; font-size: 12px; }
.visual-card-bottom { right: 12%; bottom: 24%; gap: 15px; align-items: center; padding: 18px 22px; border-radius: 18px; transform: rotate(3deg); }
.visual-card-bottom div { display: flex; flex-direction: column; gap: 3px; }
.visual-card-bottom small { color: #cfcae7; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: #67e4ad; box-shadow: 0 0 0 7px rgba(103,228,173,.14); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px 20px; color: #d9dced; background: #121624; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; color: white; text-decoration: none; font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.navigation { display: grid; gap: 7px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; border-radius: 11px; color: #9da5ba; background: transparent; text-align: left; font-size: 14px; font-weight: 650; transition: .18s ease; }
.nav-item:hover { color: white; background: rgba(255,255,255,.055); }
.nav-item.active { color: white; background: rgba(117, 102, 241, .22); }
.nav-icon { width: 21px; color: #aaa4fa; text-align: center; font-size: 18px; }
.nav-badge { margin-left: auto; min-width: 20px; padding: 2px 6px; border-radius: 10px; color: white; background: var(--red); text-align: center; font-size: 10px; }
.sidebar-spacer { flex: 1; }
.service-state, .admin-profile { display: flex; align-items: center; gap: 11px; padding: 14px 11px; }
.service-state { margin-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.09); }
.service-state div, .admin-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 2px; }
.service-state strong, .admin-profile strong { overflow: hidden; color: #edf0f8; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.service-state small, .admin-profile small { overflow: hidden; color: #7f879c; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.state-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(174,107,8,.15); }
.state-dot.online { background: #4fd19b; box-shadow: 0 0 0 4px rgba(79,209,155,.14); }
.avatar { width: 34px; height: 34px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #33289f; background: #e1defe; font-weight: 800; }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 8px; color: #858da3; background: transparent; font-size: 18px; }
.icon-button:hover { color: white; background: rgba(255,255,255,.08); }

.workspace { min-width: 0; padding: 38px clamp(24px, 4vw, 64px) 64px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.topbar h1 { margin: 0; font-size: 32px; line-height: 1.15; letter-spacing: -.035em; }
.page-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.secondary-button, .primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border-radius: 10px; font-weight: 700; }
.secondary-button { padding: 0 16px; border: 1px solid var(--line); color: #4b5563; background: var(--paper); }
.secondary-button:hover { border-color: #cbcfe0; box-shadow: 0 5px 15px rgba(17,24,39,.05); }
.secondary-button:disabled, .primary-button:disabled { cursor: wait; opacity: .55; }
.primary-button { width: 100%; margin-top: 8px; padding: 0 18px; border: 0; color: white; background: var(--purple); }
.primary-button:hover { background: var(--purple-deep); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-card { position: relative; min-height: 168px; display: flex; flex-direction: column; padding: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: 0 7px 24px rgba(17,24,39,.035); }
.metric-card.accent-card::after { content: ""; position: absolute; width: 120px; height: 120px; top: -62px; right: -45px; border-radius: 50%; background: var(--purple-soft); }
.metric-icon { width: 30px; height: 30px; display: grid; place-items: center; margin-bottom: 20px; border-radius: 9px; color: var(--purple); background: var(--purple-soft); font-weight: 850; }
.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }
.metric-icon.red { color: var(--red); background: var(--red-soft); }
.metric-label { color: #858da0; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.metric-card > strong { margin-top: 5px; font-size: 30px; letter-spacing: -.04em; }
.metric-card > small { margin-top: auto; color: var(--muted); font-size: 11px; }
.metric-card > small.cost-by-mode { margin-top: 2px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); gap: 16px; margin-top: 16px; }
.surface { border: 1px solid var(--line); border-radius: 17px; background: var(--paper); box-shadow: 0 7px 24px rgba(17,24,39,.035); }
.budget-panel, .status-panel { padding: 27px; }
.surface-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.surface-heading h2, .section-intro h2, .dialog h2 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.chip, .large-chip { border-radius: 20px; color: #574bc3; background: var(--purple-soft); font-weight: 700; }
.chip { padding: 6px 10px; font-size: 10px; }
.large-chip { padding: 9px 13px; font-size: 11px; }
.budget-amounts { display: flex; justify-content: space-between; margin-top: 32px; }
.budget-amounts div { display: flex; flex-direction: column; gap: 5px; }
.budget-amounts span, .budget-foot { color: var(--muted); font-size: 11px; }
.budget-amounts strong { font-size: 24px; letter-spacing: -.035em; }
.align-right { text-align: right; }
.progress-track { height: 9px; margin-top: 17px; overflow: hidden; border-radius: 10px; background: #eceef3; }
.progress-value { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6d60e9, #9c8ff8); transition: width .35s ease; }
.progress-value.danger { background: linear-gradient(90deg, #e07159, #c14343); }
.budget-foot { display: flex; justify-content: space-between; margin-top: 8px; }
.budget-warning { margin-top: 16px; padding: 11px 14px; border-radius: 10px; color: var(--red); background: var(--red-soft); font-size: 12px; font-weight: 700; }
.metric-card .status-pill { align-self: flex-start; margin-top: 8px; }
.inline-form { margin-top: 27px; padding-top: 21px; border-top: 1px solid var(--line); }
.inline-form > label, .dialog-form label { display: block; margin-bottom: 7px; color: #4f586a; font-size: 11px; font-weight: 700; }
.input-action { display: flex; align-items: center; overflow: hidden; border: 1px solid #d9dce5; border-radius: 10px; }
.input-action > span { padding-left: 13px; color: var(--muted); }
.input-action input { min-width: 0; flex: 1; padding: 11px 8px; border: 0; outline: 0; }
.input-action:focus-within { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(98,85,231,.11); }
.input-action button { align-self: stretch; padding: 0 17px; border: 0; color: white; background: var(--ink); font-size: 12px; font-weight: 750; }
.status-row { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.service-icon { width: 34px; height: 34px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 10px; font-weight: 850; }
.service-icon.purple { color: var(--purple); background: var(--purple-soft); }
.service-icon.blue { color: #2766b3; background: #e8f2ff; }
.service-icon.orange { color: #ac6607; background: #fff1d9; }
.status-row div { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 3px; }
.status-row strong { font-size: 12px; }
.status-row small { color: var(--muted); font-size: 10px; }
.status-pill { padding: 4px 8px; border-radius: 12px; color: var(--amber); background: var(--amber-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.status-pill.on { color: var(--green); background: var(--green-soft); }
.status-pill.off { color: var(--red); background: var(--red-soft); }
.privacy-callout { display: flex; gap: 12px; margin-top: 18px; padding: 15px; border-radius: 12px; color: #564c9f; background: #f5f3ff; }
.privacy-callout span { font-size: 20px; }
.privacy-callout p { display: flex; flex-direction: column; gap: 3px; margin: 0; font-size: 10px; line-height: 1.5; }
.privacy-callout strong { color: #342a7c; font-size: 11px; }

.table-panel { overflow: hidden; }
.table-toolbar, .section-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.search-box { width: min(420px, 70%); display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid #dfe2e9; border-radius: 10px; color: #8a92a3; }
.search-box:focus-within { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(98,85,231,.1); }
.search-box input { width: 100%; padding: 11px 0; border: 0; outline: 0; background: transparent; font-size: 13px; }
.result-count { color: var(--muted); font-size: 12px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 13px 16px; color: #8a92a3; background: #fafbfc; text-align: left; font-size: 9px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
td { padding: 15px 16px; border-top: 1px solid #eef0f4; color: #4d5668; font-size: 12px; white-space: nowrap; }
tbody tr:hover { background: #fbfbfe; }
.user-cell { min-width: 210px; display: flex; align-items: center; gap: 11px; }
.table-avatar { width: 34px; height: 34px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #5145bd; background: var(--purple-soft); font-weight: 800; }
.user-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.user-copy strong { max-width: 190px; overflow: hidden; color: var(--ink); text-overflow: ellipsis; }
.user-copy small { max-width: 190px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 12px; color: var(--green); background: var(--green-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag.blocked, .tag.uncertain { color: var(--red); background: var(--red-soft); }
.tag.started, .tag.reserved { color: var(--amber); background: var(--amber-soft); }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.action-button { padding: 7px 10px; border: 1px solid #e0e3ea; border-radius: 8px; color: #515a6b; background: white; font-size: 10px; font-weight: 750; }
.action-button:hover { border-color: #c9c3fb; color: var(--purple-deep); background: #faf9ff; }
.action-button.danger { color: var(--red); }
.empty-cell { padding: 55px 20px; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 15px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.page-button { width: 34px; height: 32px; margin-left: 6px; border: 1px solid var(--line); border-radius: 8px; color: #50596b; background: white; }
.page-button:disabled { cursor: default; opacity: .35; }
.section-intro { padding: 25px; }
.section-intro p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(11, 15, 27, .56); backdrop-filter: blur(4px); }
.dialog { position: relative; width: min(440px, 100%); padding: 30px; border-radius: 18px; background: white; box-shadow: var(--shadow); }
.dialog-close { position: absolute; top: 15px; right: 15px; width: 32px; height: 32px; border: 0; border-radius: 9px; color: #7a8293; background: #f2f3f7; font-size: 21px; }
.dialog-description { margin: 9px 0 23px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.dialog-form { display: grid; }
.dialog-form input, .dialog-form textarea { width: 100%; margin-bottom: 16px; padding: 11px 12px; border: 1px solid #dcdfe7; border-radius: 9px; outline: 0; resize: vertical; }
.dialog-form input:focus, .dialog-form textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(98,85,231,.1); }
.toast { position: fixed; z-index: 30; right: 28px; bottom: 28px; max-width: min(380px, calc(100% - 40px)); padding: 13px 17px; border-radius: 11px; color: white; background: #202637; box-shadow: var(--shadow); font-size: 12px; }
.toast.error { background: #a63636; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .login-shell { display: block; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 16px; }
  .brand { padding-bottom: 16px; }
  .navigation { display: flex; overflow-x: auto; }
  .nav-item { width: auto; flex: 0 0 auto; }
  .sidebar-spacer, .service-state { display: none; }
  .admin-profile { position: absolute; top: 13px; right: 12px; width: 180px; padding: 8px; }
  .workspace { padding: 26px 16px 48px; }
  .topbar { margin-bottom: 22px; }
  .page-subtitle { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 145px; padding: 17px; }
  .metric-card > strong { font-size: 25px; }
  .budget-panel, .status-panel { padding: 20px; }
}

@media (max-width: 480px) {
  .admin-profile { width: auto; }
  .admin-copy { display: none; }
  .topbar h1 { font-size: 27px; }
  .secondary-button { width: 42px; padding: 0; font-size: 0; }
  .secondary-button span { font-size: 17px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 135px; }
  .table-toolbar, .section-intro { align-items: flex-start; }
  .search-box { width: 100%; }
  .result-count { display: none; }
}

.feedback-message { max-width: 420px; white-space: pre-wrap; overflow-wrap: anywhere; }
