:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --soft: #f1f5fb;
  --soft-blue: #edf4ff;
  --border: #dce5f2;
  --border-strong: #c8d6ea;
  --text: #0f172a;
  --muted: #64748b;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --teal: #0f766e;
  --navy: #0b1220;
  --navy-soft: #1d2a44;
  --red: #b42318;
  --red-bg: #fff1f1;
  --amber: #9a6700;
  --amber-bg: #fff8e7;
  --green: #087a55;
  --green-bg: #eaf9f3;
  --shadow: 0 12px 36px rgba(15, 23, 42, 0.07);
  --radius: 18px;
  --radius-sm: 11px;
  --sidebar-width: 238px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { max-width: 100%; }
.skip-link { position: fixed; left: 12px; top: -100px; z-index: 100; padding: 10px 14px; border-radius: 8px; background: var(--navy); color: #fff; }
.skip-link:focus { top: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 10%, rgba(37, 99, 235, 0.2), transparent 28%), radial-gradient(circle at 90% 90%, rgba(15, 118, 110, 0.16), transparent 26%), #0b1220; }
.login-shell { width: min(430px, 100%); }
.login-card { padding: 34px; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 22px; background: rgba(255, 255, 255, 0.98); box-shadow: 0 28px 80px rgba(0, 0, 0, 0.3); }
.login-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 25px; border-bottom: 1px solid var(--border); }
.login-brand strong, .login-brand small { display: block; }
.login-brand strong { font-size: 15px; }
.login-brand small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.1em; }
.login-copy { padding: 27px 0 20px; }
.login-copy h1 { margin: 7px 0 9px; font-size: 30px; letter-spacing: -0.045em; }
.login-copy p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.login-form { display: grid; gap: 15px; }
.login-form .button { min-height: 44px; margin-top: 2px; }
.login-notice { margin: 0 0 15px; padding: 11px 12px; border: 1px solid; border-radius: 10px; font-size: 12px; line-height: 1.5; }
.login-notice-error { border-color: #edbcbc; background: var(--red-bg); color: var(--red); }
.login-notice-success { border-color: #a9dfcc; background: var(--green-bg); color: var(--green); }
.login-footnote { margin: 18px 0 0; color: var(--muted); text-align: center; font-size: 10px; }
.logout-form { margin: 0; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: var(--sidebar-width); flex-direction: column; padding: 22px 16px 18px; border-right: 1px solid var(--border); background: #f9fbff; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 23px; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: var(--blue); color: #fff; font-size: 18px; font-weight: 800; box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: -0.01em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.side-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 43px; padding: 9px 12px; border: 1px solid transparent; border-radius: 12px; color: #334155; font-size: 14px; font-weight: 650; transition: 150ms ease; }
.nav-item > span { display: grid; width: 20px; place-items: center; color: #7c8ba1; font-size: 16px; }
.nav-item:hover { background: #eef4ff; color: var(--blue); }
.nav-item.active { border-color: #c8d9ff; background: #eaf1ff; color: var(--blue); box-shadow: inset 3px 0 var(--blue); }
.nav-item.active > span { color: var(--blue); }
.sidebar-footer { display: grid; gap: 8px; margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border); }
.sidebar-footer small { margin-top: 8px; color: var(--muted); text-align: center; font-size: 11px; }
.workspace { width: calc(100% - var(--sidebar-width)); min-width: 0; margin-left: var(--sidebar-width); }
.main-content { width: min(1680px, 100%); min-height: 100vh; margin: 0 auto; padding: 22px 28px 48px; }
.mobile-header, .sidebar-scrim { display: none; }

.hero, .detail-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 16px; padding: 25px 28px; overflow: hidden; border-radius: var(--radius); background: radial-gradient(circle at 85% -20%, rgba(59, 130, 246, 0.35), transparent 34%), linear-gradient(135deg, #09101e 0%, #101c33 100%); color: #fff; box-shadow: var(--shadow); }
.hero h1, .detail-hero h1 { margin: 4px 0 7px; font-size: clamp(25px, 2.1vw, 36px); line-height: 1.15; letter-spacing: -0.035em; }
.hero p, .detail-hero p { max-width: 700px; margin: 0; color: #b7c4d8; font-size: 14px; line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.hero-actions form { margin: 0; }
.eyebrow { display: block; color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.hero .eyebrow, .detail-hero .eyebrow { color: #87b0ff; }
.detail-hero h1 small { display: inline-block; margin-left: 10px; color: #9fb0c8; font-size: 0.48em; font-weight: 600; letter-spacing: 0; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; color: #bdc9da; font-size: 13px; }
.detail-meta > span:not(.status-badge) { padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, 0.22); }
.back-link { display: inline-block; margin-bottom: 13px; color: var(--blue); font-size: 13px; font-weight: 700; }
.detail-hero .back-link { color: #b9d1ff; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: 5px 0 20px; }
.page-heading h1 { margin: 3px 0 6px; font-size: clamp(27px, 2.4vw, 38px); letter-spacing: -0.04em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }

.button { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); font-size: 13px; font-weight: 750; line-height: 1; white-space: nowrap; transition: 140ms ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { border-color: var(--blue); background: var(--blue); color: #fff; box-shadow: 0 7px 18px rgba(37, 99, 235, 0.18); }
.button-primary:hover { background: var(--blue-dark); }
.button-dark { border-color: #40506d; background: var(--navy-soft); color: #fff; }
.button-dark:hover { background: #2b3b5c; }
.button-secondary { border-color: var(--border-strong); background: #f8faff; color: #26364f; }
.button-secondary:hover { border-color: #aac1e4; background: #eef4ff; color: var(--blue); }
.button-danger { border-color: #f0b4b4; background: #fff6f6; color: var(--red); }
.button-danger:hover { background: #ffe8e8; }
.button-small { min-height: 31px; padding: 7px 10px; border-radius: 8px; font-size: 12px; }
.button-block { width: 100%; }
.icon-button { display: inline-grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--text); font-weight: 800; }
.text-link { color: var(--blue); font-size: 13px; font-weight: 750; }

.metric-grid { display: grid; gap: 12px; margin-bottom: 16px; }
.metric-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric-grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.metric-card { min-width: 0; padding: 17px 18px; border: 1px solid var(--border); border-radius: 15px; background: var(--card); box-shadow: 0 5px 18px rgba(15, 23, 42, 0.035); }
.metric-card span, .metric-card small { display: block; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.35; text-overflow: ellipsis; }
.metric-card strong { display: block; margin: 7px 0 3px; overflow: hidden; font-size: clamp(24px, 2.2vw, 34px); line-height: 1; letter-spacing: -0.04em; text-overflow: ellipsis; }
.metric-card .metric-date { font-size: clamp(16px, 1.25vw, 21px); letter-spacing: -0.02em; }
.metric-card.metric-accent { border-color: #bdd3ff; background: var(--soft-blue); }
.metric-card.metric-accent span, .metric-card.metric-accent strong { color: var(--blue); }
.metric-card.metric-warn { border-color: #f2d69d; background: var(--amber-bg); }
.metric-card.metric-warn span, .metric-card.metric-warn strong { color: var(--amber); }

.card { min-width: 0; padding: 19px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: 0 7px 24px rgba(15, 23, 42, 0.04); }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.card-header h2 { margin: 4px 0 0; font-size: 18px; letter-spacing: -0.025em; }
.card-header p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.card-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.dashboard-overview-grid { align-items: start; }
.dashboard-bottom { display: grid; grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.7fr); gap: 16px; }
.split-view { display: grid; grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.45fr); gap: 16px; align-items: start; }

.progress-list { display: grid; gap: 12px; }
.is-collapsible:not(.is-expanded) .expandable-extra { display: none; }
.expand-toggle { color: var(--blue); }
.progress-row > div { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 13px; }
.progress-row span { color: #334155; }
.progress-row progress { width: 100%; height: 9px; overflow: hidden; border: 0; border-radius: 999px; background: #edf1f7; appearance: none; }
.progress-row progress::-webkit-progress-bar { border-radius: 999px; background: #edf1f7; }
.progress-row progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, var(--blue), #65a0ff); }
.progress-row progress::-moz-progress-bar { border-radius: 999px; background: var(--blue); }
.progress-teal .progress-row progress::-webkit-progress-value { background: linear-gradient(90deg, var(--teal), #3ab6a6); }
.progress-teal .progress-row progress::-moz-progress-bar { background: var(--teal); }
.compact-form { display: flex; align-items: center; gap: 8px; }
.compact-form label { color: var(--muted); font-size: 11px; }
.compact-form select { min-width: 125px; }

.status-list { display: grid; gap: 6px; }
.status-list a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 9px; border-radius: 10px; }
.status-list a:hover { background: var(--soft); }
.status-badge, .plain-badge, .direction-badge { display: inline-flex; max-width: 210px; align-items: center; padding: 5px 8px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: 11px; font-weight: 750; white-space: nowrap; }
.status-sent { background: #eef4ff; color: var(--blue); }
.status-connected { background: #e9f8f6; color: var(--teal); }
.status-advanced { background: #f2edff; color: #6b3fc0; }
.status-signed { background: var(--green-bg); color: var(--green); }
.status-inactive { background: #f0f2f5; color: #7c8798; }
.direction-badge.inbound { background: #e9f8f6; color: var(--teal); }
.direction-badge.outbound { background: #eef4ff; color: var(--blue); }

.filter-card { margin-bottom: 16px; padding: 16px 18px; }
.filter-grid { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(140px, 0.8fr)) auto; gap: 12px; align-items: end; }
.filter-grid-5 { grid-template-columns: minmax(240px, 1.8fr) repeat(4, minmax(125px, 0.72fr)) auto; }
.field { display: grid; min-width: 0; gap: 6px; color: #334155; font-size: 12px; font-weight: 700; }
.field > span { display: block; }
.field b { color: var(--red); }
.field input, .field select, .field textarea, .compact-form select, .search-row input { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 10px; outline: none; background: #fff; color: var(--text); font-size: 13px; font-weight: 500; transition: 140ms ease; }
.field textarea { resize: vertical; line-height: 1.65; }
.field input:focus, .field select:focus, .field textarea:focus, .compact-form select:focus, .search-row input:focus { border-color: #7ca7f8; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.11); }
.field input::placeholder, .field textarea::placeholder { color: #9aa8ba; }
.filter-actions { display: flex; gap: 8px; }
.inline-warning { margin: 0 0 15px; padding: 11px 13px; border: 1px solid #efd699; border-radius: 11px; background: var(--amber-bg); color: #765100; font-size: 12px; line-height: 1.55; }

.table-card { padding: 18px; }
.table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; min-width: 860px; border-collapse: separate; border-spacing: 0; font-size: 12px; }
th { position: sticky; top: 0; z-index: 1; padding: 11px 12px; border-bottom: 1px solid var(--border); background: #f2f6fb; color: #68778c; text-align: left; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
th.sortable-header { padding: 0; }
.sort-header { display: flex; min-height: 43px; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 12px; color: #334155; font-size: 13px; font-weight: 850; letter-spacing: 0; text-transform: none; }
.sort-header:hover { background: #e8eff9; color: var(--blue); }
.sort-header.active { background: #e8f0ff; color: var(--blue); }
.sort-indicator { color: #8695aa; font-size: 12px; font-weight: 800; }
.sort-header.active .sort-indicator { color: var(--blue); }
td { max-width: 340px; padding: 11px 12px; border-bottom: 1px solid #e9eef5; color: #334155; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f9fbff; }
.row-overdue td { background: #fff8f8; }
.row-soon td { background: #fffdf6; }
.table-primary { color: #172033; font-weight: 780; }
.table-primary:hover { color: var(--blue); }
td small { display: block; margin-top: 4px; color: var(--muted); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.row-actions form { margin: 0; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 13px; color: var(--muted); font-size: 12px; }
.pagination-actions { display: flex; align-items: center; gap: 10px; }
.empty-state { display: grid; min-height: 160px; place-items: center; align-content: center; gap: 6px; padding: 24px; border: 1px dashed var(--border-strong); border-radius: 13px; color: var(--muted); text-align: center; }
.empty-state strong { color: #334155; }
.empty-state p { margin: 0; font-size: 13px; }

.entity-form { display: grid; gap: 16px; padding-bottom: 72px; }
.narrow-form { max-width: 980px; }
.form-section { padding: 22px; }
.section-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.section-heading > span { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border-radius: 9px; background: var(--soft-blue); color: var(--blue); font-size: 11px; font-weight: 850; }
.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; gap: 15px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-span-2 { grid-column: span 2; }
.choice-field { margin: 18px 0 0; padding: 0; border: 0; }
.choice-field legend { margin-bottom: 9px; color: #334155; font-size: 12px; font-weight: 750; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-grid label { cursor: pointer; }
.choice-grid input { position: absolute; opacity: 0; pointer-events: none; }
.choice-grid span { display: inline-flex; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: #fff; color: #536176; font-size: 12px; font-weight: 650; }
.choice-grid input:checked + span { border-color: #8eb3fb; background: var(--soft-blue); color: var(--blue); }
.choice-grid input:focus-visible + span { outline: 3px solid rgba(37, 99, 235, 0.18); }
.sticky-actions { position: sticky; bottom: 12px; z-index: 8; display: flex; justify-content: flex-end; gap: 9px; width: fit-content; margin-left: auto; padding: 8px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255, 255, 255, 0.94); box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12); backdrop-filter: blur(12px); }
.stack-form { display: grid; gap: 14px; }

.summary-strip { display: grid; grid-template-columns: 1fr 1fr 1fr 1.5fr; gap: 1px; margin: -2px 0 16px; overflow: hidden; border: 1px solid var(--border); border-radius: 15px; background: var(--border); }
.summary-strip > div { min-width: 0; padding: 14px 16px; background: #fff; }
.summary-strip span, .summary-strip strong { display: block; }
.summary-strip span { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.05em; }
.summary-strip strong { margin-top: 5px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.tabs { margin-top: 16px; }
.tab-list { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; padding: 5px; border: 1px solid var(--border); border-radius: 13px; background: #edf2f8; }
.tab-list button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 8px 13px; border: 0; border-radius: 9px; background: transparent; color: #58677c; font-size: 12px; font-weight: 750; white-space: nowrap; }
.tab-list button span { display: inline-grid; min-width: 20px; height: 20px; place-items: center; border-radius: 999px; background: #dfe7f2; font-size: 10px; }
.tab-list button.active { background: #fff; color: var(--blue); box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.timeline { display: grid; }
.timeline article { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; }
.timeline article:not(:last-child)::before { position: absolute; top: 22px; bottom: -4px; left: 7px; width: 1px; background: var(--border); content: ""; }
.timeline-dot { position: relative; z-index: 1; width: 15px; height: 15px; margin-top: 17px; border: 4px solid #dbe8ff; border-radius: 50%; background: var(--blue); }
.timeline-card { margin-bottom: 10px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fbfcff; }
.timeline-card header { display: flex; justify-content: space-between; gap: 12px; }
.timeline-card header strong, .timeline-card header span { display: block; }
.timeline-card header span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.timeline-card h3 { margin: 10px 0 4px; font-size: 14px; }
.timeline-card p { margin: 7px 0 0; color: #48566b; font-size: 12px; line-height: 1.6; }
.timeline-card .followup-body { max-width: 90ch; font-size: 13px; line-height: 1.7; }
.timeline-card .timeline-empty { color: var(--muted); }
.pre-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.task-list { display: grid; gap: 9px; }
.task-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px; }
.task-item.overdue { border-color: #f2c0c0; background: #fff8f8; }
.task-item.soon { border-color: #efdcae; background: #fffdf7; }
.task-item h3 { margin: 4px 0; font-size: 14px; }
.task-item p, .task-item span { margin: 0; color: var(--muted); font-size: 11px; }
.task-actions { display: flex; align-items: center; gap: 7px; }
.script-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.script-card { display: flex; min-height: 240px; flex-direction: column; padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: #fbfcff; }
.script-card header { display: flex; justify-content: space-between; gap: 12px; }
.script-card header span { color: var(--blue); font-size: 10px; font-weight: 750; }
.script-card h3 { margin: 4px 0 0; font-size: 14px; }
.script-card > p { flex: 1; color: #3e4c61; font-size: 12px; line-height: 1.65; }
.script-card footer { display: flex; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.script-card footer a { color: var(--blue); font-weight: 700; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.detail-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-grid > div { min-width: 0; padding: 12px; border-radius: 11px; background: var(--soft); }
.detail-grid dt { color: var(--muted); font-size: 10px; font-weight: 750; }
.detail-grid dd { margin: 5px 0 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 700; }
.profile-panel > .card-header { margin-bottom: 20px; }
.profile-panel > .card-header h2 { font-size: 24px; letter-spacing: -0.035em; }
.profile-sections { display: grid; gap: 22px; }
.profile-group + .profile-group { padding-top: 22px; border-top: 1px solid var(--border); }
.profile-group-header { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.profile-group-header > span { display: grid; width: 31px; height: 31px; flex: 0 0 auto; place-items: center; border-radius: 9px; background: var(--soft-blue); color: var(--blue); font-size: 11px; font-weight: 850; }
.profile-group-header h3 { margin: 0; font-size: 17px; letter-spacing: -0.02em; }
.profile-group-header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; margin: 0; }
.profile-grid > div { min-width: 0; padding: 13px 2px; border-top: 1px solid #e9eef6; }
.profile-grid > div:nth-child(-n + 3) { border-top: 0; }
.profile-grid dt { color: #64748b; font-size: 12px; font-weight: 750; }
.profile-grid dd { margin: 6px 0 0; overflow-wrap: anywhere; color: #172033; font-size: 14px; font-weight: 750; line-height: 1.45; }
.profile-grid-key dd { font-size: 15px; }
.profile-grid .profile-field-primary { padding-right: 10px; }
.profile-grid .profile-field-primary dd { color: var(--blue-dark); }
.profile-grid dd.is-empty { color: #94a3b8; font-weight: 500; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 20px; padding: 14px; border: 1px solid #f0c6c6; border-radius: 12px; background: #fff8f8; }
.danger-zone h3 { margin: 0; color: var(--red); font-size: 13px; }
.danger-zone p { margin: 4px 0 0; color: #815252; font-size: 11px; }

.company-summary { align-items: stretch; }
.corridors { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--border); }
.corridors h3 { margin: 0 0 8px; font-size: 12px; }
.corridors span { display: inline-flex; margin: 0 5px 5px 0; padding: 6px 9px; border-radius: 999px; background: var(--soft-blue); color: var(--blue); font-size: 11px; font-weight: 700; }

.scope-picker { margin-bottom: 16px; }
.segmented { display: flex; padding: 3px; border-radius: 10px; background: var(--soft); }
.segmented a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 750; }
.segmented a.active { background: #fff; color: var(--blue); box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08); }
.chip-list { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: #536176; font-size: 11px; font-weight: 700; }
.chip span { display: inline-grid; min-width: 20px; height: 20px; place-items: center; border-radius: 999px; background: var(--soft); font-size: 10px; }
.chip.active { border-color: #8eb3fb; background: var(--soft-blue); color: var(--blue); }
.search-row { display: flex; align-items: end; gap: 9px; }
.search-row .field { flex: 1; }
.script-list { padding: 14px; }
.script-list nav { display: grid; gap: 5px; max-height: 720px; overflow-y: auto; }
.script-list-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border: 1px solid transparent; border-radius: 11px; }
.script-list-item:hover { background: var(--soft); }
.script-list-item.active { border-color: #c7d9ff; background: var(--soft-blue); }
.script-list-item strong, .script-list-item span { display: block; }
.script-list-item strong { margin-bottom: 4px; font-size: 13px; }
.script-list-item span { color: var(--muted); font-size: 10px; }
.script-list-item.active > span { color: var(--blue); }
.script-detail { min-height: 530px; }
.script-content { margin-top: 14px; padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: #fbfcff; }
.script-content h3 { margin: 0 0 9px; font-size: 12px; }
.script-content p { margin: 0; color: #35445a; font-size: 13px; line-height: 1.75; }
.muted-content { background: var(--soft); }

.data-files-card { margin-bottom: 16px; }
.download-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.download-list a { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.download-list a:hover { border-color: #9bb9eb; background: #f8fbff; }
.download-list strong, .download-list small { display: block; }
.download-list strong { font-size: 13px; }
.download-list small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.download-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; background: var(--green-bg); color: var(--green); font-size: 12px; font-weight: 850; }
.download-icon.database { background: var(--soft-blue); color: var(--blue); }
.path-box { display: grid; gap: 5px; margin-top: 14px; padding: 11px; border-radius: 10px; background: var(--soft); }
.path-box span { color: var(--muted); font-size: 10px; font-weight: 700; }
.path-box code { overflow-wrap: anywhere; font-size: 11px; }
.options-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.option-card { display: grid; gap: 9px; padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: #fbfcff; }

.flash-stack { position: fixed; top: 14px; right: 18px; z-index: 70; display: grid; width: min(420px, calc(100vw - 32px)); gap: 7px; }
.flash { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: 0 12px 34px rgba(15, 23, 42, 0.16); font-size: 12px; font-weight: 650; }
.flash-success { border-color: #a9dfcc; background: var(--green-bg); color: #075c42; }
.flash-error { border-color: #edbcbc; background: var(--red-bg); color: var(--red); }
.flash button { border: 0; background: transparent; color: inherit; font-size: 17px; }
.error-page { display: grid; min-height: 75vh; place-items: center; align-content: center; text-align: center; }
.error-page h1 { margin: 8px 0; color: var(--blue); font-size: 86px; line-height: 1; letter-spacing: -0.07em; }
.error-page p { max-width: 520px; margin: 0 0 20px; color: var(--muted); }

@media (max-width: 1280px) {
  .metric-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-grid, .filter-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-grid .field-wide, .filter-grid-5 .field-wide { grid-column: span 2; }
  .options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  :root { --sidebar-width: 220px; }
  .main-content { padding: 18px 18px 40px; }
  .metric-grid-4, .metric-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column, .dashboard-bottom, .split-view { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .script-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-grid > div:nth-child(3) { border-top: 1px solid #e9eef6; }
  .profile-grid > div:nth-child(-n + 2) { border-top: 0; }
}

@media (max-width: 760px) {
  .sidebar { transform: translateX(-105%); transition: transform 180ms ease; box-shadow: 18px 0 40px rgba(15, 23, 42, 0.16); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 20; background: rgba(10, 18, 32, 0.42); }
  body.sidebar-open .sidebar-scrim { display: block; }
  .workspace { width: 100%; margin-left: 0; }
  .mobile-header { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; height: 58px; padding: 0 15px; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(12px); }
  .main-content { padding: 14px 12px 34px; }
  .hero, .detail-hero { flex-direction: column; padding: 21px 19px; }
  .hero-actions { justify-content: flex-start; }
  .metric-grid-6, .metric-grid-5, .metric-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid, .filter-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid .field-wide, .filter-grid-5 .field-wide { grid-column: span 2; }
  .filter-actions { grid-column: span 2; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .field-span-2 { grid-column: span 1; }
  .options-grid { grid-template-columns: 1fr; }
  .script-detail { min-height: 0; }
  .task-item, .danger-zone { align-items: flex-start; flex-direction: column; }
  .task-actions { flex-wrap: wrap; }
  .page-heading { flex-direction: column; }
  .card-header-actions { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .login-page { padding: 12px; }
  .login-card { padding: 25px 21px; border-radius: 18px; }
  .metric-grid-6, .metric-grid-5, .metric-grid-4 { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: 14px; }
  .metric-card strong { font-size: 25px; }
  .filter-grid, .filter-grid-5 { grid-template-columns: 1fr; }
  .filter-grid .field-wide, .filter-grid-5 .field-wide, .filter-actions { grid-column: span 1; }
  .filter-actions .button { flex: 1; }
  .card { padding: 15px; border-radius: 15px; }
  .summary-strip { grid-template-columns: 1fr; }
  .detail-grid, .detail-grid-2 { grid-template-columns: 1fr; }
  .profile-grid, .download-list { grid-template-columns: 1fr; }
  .profile-grid > div:nth-child(2) { border-top: 1px solid #e9eef6; }
  .profile-grid > div:first-child { border-top: 0; }
  .sticky-actions { width: 100%; justify-content: stretch; }
  .sticky-actions .button { flex: 1; }
  .search-row { align-items: stretch; flex-direction: column; }
  .pagination { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
