:root {
    color-scheme: light;
    --background: #f5f5f7;
    --surface: rgba(255, 255, 255, 0.88);
    --text: #1d1d1f;
    --muted: #6e6e73;
    --line: rgba(0, 0, 0, 0.10);
    --accent: #0071e3;
    --danger-bg: #fff2f2;
    --danger: #a52222;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); }
button, input, select { font: inherit; }
a { color: var(--accent); text-decoration: none; }
.auth-page { min-height: 100vh; background: radial-gradient(circle at 50% 0, #fff 0, var(--background) 52%); }
.auth-shell { min-height: 100vh; display: grid; place-content: center; padding: 32px 20px; }
.auth-card { width: min(100%, 430px); padding: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 24px 70px rgba(0,0,0,.08); backdrop-filter: blur(24px); }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 24px; border-radius: 13px; color: #fff; background: linear-gradient(145deg,#2e92f2,#0066cc); box-shadow: 0 8px 18px rgba(0,113,227,.22); }
.brand-mark svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 13px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
h1 { margin: 0; font-size: 25px; line-height: 1.2; letter-spacing: -.022em; font-weight: 600; }
.subtitle { margin: 12px 0 28px; color: var(--muted); line-height: 1.5; }
.form-stack { display: grid; gap: 18px; }
label { display: grid; gap: 8px; }
label span { color: #3a3a3c; font-size: 14px; font-weight: 550; }
input { width: 100%; min-height: 48px; padding: 0 14px; color: var(--text); background: rgba(255,255,255,.9); border: 1px solid rgba(0,0,0,.16); border-radius: 12px; outline: none; transition: border-color .15s,box-shadow .15s; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,113,227,.13); }
button { min-height: 48px; padding: 0 18px; border: 0; border-radius: 12px; color: #fff; background: var(--accent); font-weight: 650; cursor: pointer; }
button:hover { background: #0077ed; }
.alert { margin: 0 0 20px; padding: 12px 14px; color: var(--danger); background: var(--danger-bg); border-radius: 10px; font-size: 14px; line-height: 1.4; }
.security-note { margin: 22px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.app-header { position: sticky; top: 0; z-index: 30; height: 60px; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--line); backdrop-filter: blur(20px); }
.header-main { height: 100%; display: grid; grid-template-columns: 240px 1fr 240px; align-items: center; padding: 0 18px; }
.wordmark { display: flex; align-items: center; gap: 9px; width: max-content; color: var(--text); font-size: 15px; font-weight: 650; letter-spacing: -.015em; }
.wordmark-icon { display: grid; place-items: center; width: 29px; height: 29px; color: #fff; background: linear-gradient(145deg,#2389ed,#0066cc); border-radius: 8px; font-size: 13px; box-shadow: 0 5px 12px rgba(0,113,227,.18); }
.live-clock { justify-self: center; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.user-menu { justify-self: end; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.user-menu > span { max-width: 140px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; }
.quiet-button { min-height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 10px; color: var(--accent); background: transparent; font-size: 12px; }
.quiet-button:hover { background: rgba(0,113,227,.08); }
.nav-icon, .menu-toggle svg, .menu-close svg, .quiet-button svg, .sidebar-toggle svg { flex: 0 0 auto; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-sidebar { position: fixed; z-index: 25; top: 60px; bottom: 0; left: 0; display: flex; flex-direction: column; width: 226px; padding: 12px 10px 10px; background: #fff; border-right: 1px solid var(--line); transition: width .2s ease; }
.main-navigation { display: flex; flex: 1 1 auto; flex-direction: column; gap: 3px; overflow-x: hidden; overflow-y: auto; }
.main-navigation a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; color: #414146; font-size: 12px; font-weight: 570; letter-spacing: .018em; text-transform: uppercase; border-radius: 9px; white-space: nowrap; }
.main-navigation a:hover { color: var(--text); background: #f5f5f7; }
.main-navigation a[aria-current="page"] { color: var(--accent); background: rgba(0,113,227,.09); }
.sidebar-toggle { display: flex; align-items: center; gap: 12px; min-height: 43px; margin-bottom: 8px; padding: 0 12px 7px; color: var(--muted); background: transparent; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 12px; font-weight: 500; }
.sidebar-toggle:hover { color: var(--text); background: #f5f5f7; border-radius: 8px; }
.sidebar-collapsed .app-sidebar { width: 66px; }
.sidebar-collapsed .main-navigation a { justify-content: center; padding-inline: 0; }
.sidebar-collapsed .main-navigation a span, .sidebar-collapsed .sidebar-toggle span { display: none; }
.sidebar-collapsed .sidebar-toggle { justify-content: center; padding-inline: 0; }
.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.workspace { width: auto; max-width: 1440px; margin: 30px 28px 30px 254px; transition: margin-left .2s ease; }
.sidebar-collapsed .workspace { margin-left: 94px; }
.page-heading { min-height: 48px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.content-panel { min-height: 240px; padding: 22px 24px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.content-panel h2 { margin: 0 0 7px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.content-panel p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: #8a8a8f; font-size: 11px; font-weight: 620; letter-spacing: .045em; text-transform: uppercase; }
.breadcrumbs a { color: #717177; }
.breadcrumbs a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumbs span[aria-current="page"] { color: #515156; }
.page-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.primary-action, .secondary-action { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 15px; border-radius: 9px; font-size: 13px; font-weight: 600; }
.primary-action svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.primary-action { color: #fff; background: var(--accent); }
.primary-action:hover { background: #0077ed; }
.secondary-action { color: #3f3f44; background: #fff; border: 1px solid var(--line); }
.system-grid { display: grid; grid-template-columns: repeat(3,minmax(220px,1fr)); gap: 14px; }
.system-card { display: flex; align-items: center; gap: 16px; min-height: 94px; padding: 20px; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 13px; transition: border-color .15s,box-shadow .15s,transform .15s; }
.system-card:not(.is-disabled):hover { border-color: rgba(0,113,227,.35); box-shadow: 0 8px 24px rgba(0,0,0,.06); transform: translateY(-1px); }
.system-card > svg { flex: 0 0 auto; width: 25px; height: 25px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.system-card span { display: grid; gap: 5px; }
.system-card strong { font-size: 14px; font-weight: 620; }
.system-card small { color: var(--muted); font-size: 12px; }
.system-card.is-disabled { opacity: .56; }
.notice { display: grid; gap: 8px; margin-bottom: 16px; padding: 14px 16px; border: 1px solid; border-radius: 10px; font-size: 13px; opacity: 1; transform: translateY(0); transition: opacity .25s ease,transform .25s ease; }
.notice.is-dismissing { opacity: 0; transform: translateY(-5px); }
.notice.success { color: #17653a; background: #f0faf4; border-color: #bfe4cd; }
.notice.error { color: var(--danger); background: var(--danger-bg); border-color: #f0c4c4; }
.notice code { width: max-content; padding: 5px 8px; color: var(--text); background: #fff; border: 1px solid rgba(0,0,0,.1); border-radius: 6px; font-size: 14px; user-select: all; }
.notice ul { margin: 0; padding-left: 20px; }
.notice small { opacity: .8; }
.table-panel { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 14px; color: var(--muted); background: #fafafa; font-size: 11px; font-weight: 650; letter-spacing: .035em; text-align: left; text-transform: uppercase; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid rgba(0,0,0,.065); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfbfc; }
td strong { font-weight: 600; }
.own-account { display: block; margin-top: 3px; color: var(--muted); }
.table-action { text-align: right; }
.table-action a { font-weight: 570; }
.icon-action { display: inline-grid; place-items: center; width: 32px; height: 32px; color: #55555a; background: #fff; border: 1px solid rgba(0,0,0,.16); border-radius: 7px; box-shadow: none; }
.icon-action:hover { color: var(--accent); background: #f7f7f8; border-color: rgba(0,0,0,.24); box-shadow: none; }
.icon-action svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.status-badge { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border-radius: 20px; font-size: 11px; font-weight: 620; }
.status-badge.active { color: #17653a; background: #eaf7ef; }
.status-badge.inactive { color: #6e6e73; background: #eeeeef; }
.narrow-workspace { max-width: 1050px; }
.editor-form { display: grid; gap: 15px; }
.form-section { display: grid; grid-template-columns: 210px 1fr; gap: 26px; padding: 22px 24px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.section-heading h2 { margin: 0; font-size: 15px; font-weight: 620; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; }
.form-grid .full-width { grid-column: 1/-1; }
.form-grid input:not([type="checkbox"]), .form-grid select { width: 100%; min-height: 42px; padding: 0 12px; color: var(--text); background: #fff; border: 1px solid rgba(0,0,0,.17); border-radius: 8px; outline: none; }
.form-grid input:focus, .form-grid select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,113,227,.11); }
.switch-row, .check-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.switch-row { align-self: end; min-height: 42px; align-items: center; }
.switch-row input, .check-row input { flex: 0 0 auto; width: 17px; height: 17px; min-height: 0; margin: 1px 0 0; accent-color: var(--accent); }
.switch-row > span, .warning-check > span { display: grid; gap: 3px; }
.switch-row small, .warning-check small { color: var(--muted); font-weight: 400; line-height: 1.35; }
.permission-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 24px; row-gap: 10px; }
.permission-grid h3 { grid-column: 1/-1; margin: 13px 0 1px; padding-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 680; letter-spacing: .045em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.permission-grid h3:first-child { margin-top: 0; }
.check-row span { color: #3f3f44; font-size: 12px; line-height: 1.4; }
.compact-section { grid-template-columns: 1fr; }
.warning-check strong { color: var(--text); font-size: 13px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-bottom: 24px; }
.form-actions button { min-height: 38px; border-radius: 9px; font-size: 13px; }
.mobile-navigation-head, .menu-toggle, .navigation-backdrop { display: none; }

@media (max-width:1120px) {
    body.navigation-open { overflow: hidden; }
    .app-header { height: 58px; }
    .header-main { grid-template-columns: auto auto 1fr auto; gap: 10px; padding: 0 14px; }
    .menu-toggle { display: grid; place-items: center; width: 38px; min-height: 38px; padding: 0; color: var(--text); background: transparent; border-radius: 9px; }
    .menu-toggle:hover { background: rgba(0,0,0,.05); }
    .live-clock { justify-self: end; margin-right: 8px; }
    .app-sidebar { z-index: 1002; top: 0; width: min(86vw,340px); height: 100vh; height: 100dvh; padding: 8px 12px 14px; border-right: 0; box-shadow: 20px 0 60px rgba(0,0,0,.16); transform: translateX(-105%); transition: transform .24s ease; }
    .navigation-open .app-sidebar { transform: translateX(0); }
    .mobile-navigation-head { min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 4px 12px; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
    .menu-close { display: grid; place-items: center; width: 36px; min-height: 36px; padding: 0; color: var(--muted); background: transparent; border-radius: 9px; }
    .menu-close:hover { color: var(--text); background: rgba(0,0,0,.05); }
    .main-navigation { padding-top: 6px; }
    .main-navigation a { min-height: 46px; gap: 13px; padding-inline: 13px; font-size: 13px; }
    .main-navigation .nav-icon { width: 20px; height: 20px; }
    .sidebar-toggle { display: none; }
    .sidebar-collapsed .app-sidebar { width: min(86vw,340px); }
    .sidebar-collapsed .main-navigation a { justify-content: flex-start; padding-inline: 13px; }
    .sidebar-collapsed .main-navigation a span { display: inline; }
    .navigation-backdrop { position: fixed; z-index: 1001; inset: 0; display: block; width: 100vw; height: 100vh; height: 100dvh; background: rgba(20,24,30,.32); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease,visibility 0s linear .2s; }
    .navigation-open .navigation-backdrop { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
    .workspace, .sidebar-collapsed .workspace { margin: 24px 20px; }
}
@media (max-width:700px) {
    .breadcrumbs { display: none; }
    .live-clock { display: none; }
    .header-main { grid-template-columns: auto 1fr auto; }
    .user-menu { justify-self: end; }
    .user-menu > span, .quiet-button span { display: none; }
    .system-grid { grid-template-columns: 1fr; }
    .form-section { grid-template-columns: 1fr; gap: 18px; padding: 18px; }
    .permission-grid { grid-template-columns: 1fr; }
    .page-heading { align-items: flex-end; }
}
@media (max-width:520px) {
    .auth-card { padding: 30px 22px; border-radius: 20px; }
    .workspace, .sidebar-collapsed .workspace { margin: 20px 12px; }
    .wordmark > span:last-child { font-size: 14px; }
}
@media (prefers-reduced-motion:reduce) { .app-sidebar, .navigation-backdrop, .workspace { transition: none; } }
