:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --soft: #f7f9fb;
  --line: #dde5ec;
  --ink: #26313d;
  --muted: #73808f;
  --brand: #0781df;
  --brand-dark: #0568b5;
  --brand-soft: #e8f3fd;
  --rail: #087fe0;
  --danger: #b43f2f;
  --warn: #a16a00;
  --ok: #24734f;
  --shadow: 0 20px 46px rgba(34, 48, 64, 0.10);
  --shadow-soft: 0 9px 22px rgba(34, 48, 64, 0.07);
  --font-sans: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-sans); margin: 0; text-rendering: optimizeLegibility; }
a { color: inherit; }
input, select, textarea, button { font: inherit; }
input, select, textarea { background: #fff; border: 1px solid var(--line); border-radius: 4px; min-height: 42px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(7,129,223,0.14); outline: none; }

.app-shell { display: grid; grid-template-columns: 48px 190px minmax(0, 1fr); min-height: 100vh; }
.icon-rail { align-items: center; background: var(--rail); color: #fff; display: flex; flex-direction: column; gap: 24px; min-height: 100vh; padding: 16px 8px; position: sticky; top: 0; }
.icon-rail nav { display: grid; gap: 12px; width: 100%; }
.icon-rail a { align-items: center; border-radius: 4px; color: rgba(255,255,255,.78); display: flex; height: 32px; justify-content: center; text-decoration: none; width: 32px; }
.icon-rail a:hover, .icon-rail a.active { background: rgba(255,255,255,.16); color: #fff; }
.rail-brand { margin-bottom: 18px; }
.rail-brand img { border-radius: 50%; height: 26px; width: 26px; }
.rail-bottom { margin-top: auto; }
.sidebar { background: #fff; border-right: 1px solid var(--line); color: var(--ink); height: 100vh; overflow: auto; padding: 52px 20px 20px; position: sticky; top: 0; }
.brand { align-items: center; display: flex; gap: 12px; margin-bottom: 28px; padding: 0; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.18rem; font-weight: 700; }
.brand small { color: var(--muted); font-size: .78rem; margin-top: 3px; }
.sidebar nav { display: grid; gap: 4px; }
.nav-section { color: var(--muted); display: block; font-size: .68rem; font-weight: 800; letter-spacing: .08em; margin: 18px 0 8px; text-transform: uppercase; }
.nav-section:first-child { margin-top: 0; }
.sidebar nav a { align-items: center; border-radius: 4px; color: #596675; display: flex; font-size: .88rem; font-weight: 600; gap: 10px; padding: 9px 0; text-decoration: none; transition: color .15s ease; }
.sidebar nav a i { color: #8a98a8; font-size: .98rem; width: 18px; }
.sidebar nav a:hover, .sidebar nav a.active { color: #101820; }
.sidebar nav a.active i { color: var(--brand); }
.sidebar nav a.nav-category { color: #263849; font-size: .86rem; font-weight: 800; padding-top: 10px; }
.sidebar nav a.nav-subitem { font-size: .82rem; font-weight: 600; padding: 7px 0 7px 12px; }
.sidebar nav a.nav-subitem i { font-size: .9rem; width: 16px; }

.workspace { padding: 32px 36px; }
.topbar, .panel, .search-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow-soft); }
.topbar { align-items: center; background: transparent; border: 0; box-shadow: none; display: flex; gap: 16px; justify-content: space-between; padding: 0 0 18px; }
.topbar p, .eyebrow { color: var(--brand); font-size: .76rem; font-weight: 800; letter-spacing: .08em; margin: 0 0 5px; text-transform: uppercase; }
h1, h2 { letter-spacing: 0; margin: 0; }
h1 { font-size: 1.55rem; font-weight: 500; }
h2 { font-size: 1.15rem; }
.hint { color: var(--muted); margin: 6px 0 0; }
.session, .toolbar, .form-actions, .inline-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; }
.session-name { color: var(--ink); font-size: .86rem; font-weight: 700; }

.panel, .search-panel { margin-top: 18px; padding: 18px; }
.panel-heading, .action-panel { align-items: start; display: flex; gap: 14px; justify-content: space-between; }
.action-panel { align-items: center; }
.button { align-items: center; border: 1px solid var(--line); border-radius: 3px; cursor: pointer; display: inline-flex; font-size: .82rem; font-weight: 800; justify-content: center; min-height: 36px; padding: 8px 14px; text-decoration: none; text-transform: uppercase; }
.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.button.secondary { background: #fff; color: var(--ink); }
.button.small { font-size: .84rem; min-height: 32px; padding: 6px 10px; }

.stats-grid, .details-grid, .report-grid, .module-strip { display: grid; gap: 14px; margin-top: 18px; }
.stats-grid { grid-template-columns: repeat(4, minmax(140px, 1fr)); }
.details-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
.report-grid { grid-template-columns: repeat(2, minmax(280px, 1fr)); }
.module-strip { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.module-card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow-soft); display: grid; gap: 6px; min-height: 92px; padding: 16px; text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.module-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); }
.module-card.active { background: var(--brand-soft); border-color: rgba(18,97,93,.35); }
.module-card span { color: var(--brand); font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.module-card strong { color: var(--ink); line-height: 1.25; }
.config-overview { display: grid; gap: 14px; }
.config-overview .button { justify-self: start; }
.stats-grid article { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow-soft); padding: 18px; }
.stats-grid span { color: var(--muted); display: block; font-size: .82rem; font-weight: 700; text-transform: uppercase; }
.stats-grid strong { display: block; font-size: 2rem; margin-top: 6px; }
.metric { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; padding: 10px 0; }
.metric:last-child { border-bottom: 0; }
.process-log { display: grid; gap: 8px; }
.process-step { align-items: center; border-bottom: 1px solid var(--line); display: flex; gap: 12px; padding: 8px 0; }
.process-step:last-child { border-bottom: 0; }
.process-step strong { color: var(--brand); font-size: .78rem; min-width: 64px; }

.filters, .form-grid { display: grid; gap: 12px; }
.filters { align-items: end; grid-template-columns: minmax(220px, 1fr) 220px auto auto; }
.form-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.compact-config { grid-template-columns: minmax(220px, 1fr) 120px 120px auto; }
.form-grid label, .filters label { color: var(--muted); display: grid; gap: 7px; font-size: .88rem; font-weight: 700; }
.form-grid .wide, .form-grid .form-actions { grid-column: 1 / -1; }
.label-title { color: var(--muted); display: block; font-size: .88rem; font-weight: 700; margin-bottom: 8px; }
.check { align-items: center; color: var(--ink); display: flex !important; gap: 8px; }
.check input, .tag-check input { min-height: auto; width: auto; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; min-width: 880px; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 10px; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; }
tbody tr:hover { background: #f8fafc; }
.clickable-row { cursor: pointer; }
.clickable-row:hover .row-link { color: var(--brand); }
.row-link { color: var(--ink); text-decoration: none; }
.row-link:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.row-link.strong { font-weight: 800; }
.row-link.muted { color: var(--muted); }
.thumb { border: 1px solid var(--line); border-radius: 4px; display: block; height: 54px; margin-bottom: 8px; object-fit: cover; width: 74px; }
.table-wrap input[type="file"] { min-width: 180px; }
.compact-table table { min-width: 620px; }
.centers-table table { min-width: 1120px; }
.centers-table td { vertical-align: top; }
.centers-table td input + input { margin-top: 8px; }
.centers-table td select { min-width: 170px; }
.status { background: var(--soft); border-radius: 999px; color: var(--ink); display: inline-flex; font-size: .72rem; font-weight: 800; padding: 5px 9px; white-space: nowrap; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-check { background: var(--soft); border: 1px solid var(--line); border-radius: 999px; color: var(--ink) !important; display: inline-flex !important; gap: 6px !important; padding: 7px 10px; }
.tag-chip { background: var(--brand-soft); border: 1px solid rgba(7,129,223,.18); border-radius: 999px; color: var(--brand-dark); display: inline-flex; font-size: .82rem; font-weight: 800; padding: 7px 10px; }
.file-priority { background: var(--brand-soft); border: 1px solid rgba(7,129,223,.18); border-radius: 4px; padding: 12px; }
.keyword-field { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 10px; }
.keyword-field .keyword-input { border: 0; box-shadow: none; min-height: 30px; padding: 4px 0; }
.keyword-field .keyword-input:focus { box-shadow: none; }
.keyword-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.keyword-chip { background: var(--brand-soft); border: 1px solid rgba(7,129,223,.2); border-radius: 999px; color: var(--brand-dark); cursor: pointer; font-size: .82rem; font-weight: 800; padding: 6px 10px; }
.inline-option-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.inline-option-grid article { background: var(--soft); border: 1px solid var(--line); border-radius: 4px; padding: 12px; }
.option-list { border: 1px solid var(--line); border-radius: 4px; display: grid; gap: 6px; max-height: 320px; overflow: auto; padding: 10px; }
.option-check { align-items: flex-start; background: var(--soft); border: 1px solid var(--line); border-radius: 4px; color: var(--ink) !important; display: flex !important; gap: 9px !important; padding: 9px 10px; }
.option-check input { margin-top: 3px; min-height: auto; width: auto; }
.option-check strong, .option-check small { display: block; }
.option-check small { color: var(--muted); font-weight: 400; margin-top: 3px; }
.permission-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tag-check small { color: var(--muted); font-weight: 400; }

.alert { border-radius: 4px; margin-top: 18px; padding: 12px 14px; }
.alert.success { background: #e8f4ec; color: var(--ok); }
.alert.error { background: #f5e8e6; color: var(--danger); }
footer { color: var(--muted); font-size: .86rem; padding: 22px 4px 4px; text-align: center; }

.login-page { background: radial-gradient(circle at 12% 14%, rgba(7,129,223,.28), transparent 28%), linear-gradient(135deg, #eaf4ff 0%, #f7f9fc 48%, #dceefe 100%); display: grid; min-height: 100vh; padding: 28px; place-items: center; }
.login-shell { background: rgba(255,255,255,.92); border: 1px solid rgba(255,255,255,.78); border-radius: 28px; box-shadow: 0 30px 80px rgba(28, 62, 98, .20); display: grid; grid-template-columns: minmax(320px, .95fr) minmax(360px, .78fr); max-width: 1120px; min-height: 680px; overflow: hidden; width: min(100%, 1120px); }
.login-visual { background: linear-gradient(145deg, #087fe0 0%, #0568b5 52%, #043e78 100%); color: #fff; display: flex; flex-direction: column; justify-content: space-between; min-height: 100%; overflow: hidden; padding: 34px; position: relative; }
.login-visual::before { background: rgba(255,255,255,.12); border-radius: 42px; content: ""; height: 300px; position: absolute; right: -120px; top: -90px; transform: rotate(18deg); width: 300px; }
.login-visual::after { background: rgba(255,255,255,.08); border-radius: 999px; bottom: -120px; content: ""; height: 260px; left: -80px; position: absolute; width: 260px; }
.login-visual-top, .login-visual-copy, .login-illustration { position: relative; z-index: 1; }
.login-visual-top { align-items: center; display: flex; gap: 12px; font-size: 1.05rem; font-weight: 800; }
.login-visual-top img { background: #fff; border-radius: 50%; height: 38px; padding: 4px; width: 38px; }
.login-visual-copy { max-width: 430px; }
.login-visual-copy .eyebrow { color: rgba(255,255,255,.72); }
.login-visual-copy h1 { color: #fff; font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 700; line-height: 1.05; margin: 0 0 16px; }
.login-visual-copy p:last-child { color: rgba(255,255,255,.78); font-size: 1rem; line-height: 1.65; margin: 0; }
.login-illustration { height: 270px; margin-top: 32px; }
.doc-card { background: rgba(255,255,255,.94); border: 1px solid rgba(255,255,255,.6); border-radius: 18px; box-shadow: 0 24px 45px rgba(2, 33, 70, .28); display: grid; gap: 12px; padding: 22px; position: absolute; }
.doc-card span, .doc-card i { background: #dceefe; border-radius: 999px; display: block; height: 12px; }
.doc-card-main { bottom: 20px; left: 10px; width: 280px; }
.doc-card-main span:first-child { background: var(--brand); height: 34px; width: 92px; }
.doc-card-main span:nth-child(2) { width: 85%; }
.doc-card-main span:nth-child(3) { width: 64%; }
.doc-card-small { right: 8px; top: 22px; width: 190px; }
.doc-card-small i { background: #17a2ff; height: 42px; width: 42px; }
.doc-card-small span:nth-child(2) { width: 90%; }
.doc-card-small span:nth-child(3) { width: 58%; }
.login-chart { align-items: end; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 18px; bottom: 0; display: flex; gap: 12px; height: 120px; padding: 18px; position: absolute; right: 68px; width: 190px; }
.login-chart span { background: rgba(255,255,255,.82); border-radius: 999px 999px 6px 6px; display: block; flex: 1; }
.login-chart span:nth-child(1) { height: 46%; }
.login-chart span:nth-child(2) { height: 74%; }
.login-chart span:nth-child(3) { height: 58%; }
.login-panel { align-content: center; background: #f8fbff; display: grid; padding: clamp(30px, 5vw, 72px); }
.login-panel .login-brand { margin-bottom: 34px; }
.login-brand { align-items: center; display: flex; gap: 12px; }
.login-brand img { border-radius: 12px; height: 52px; width: 52px; }
.login-brand strong, .login-brand span { display: block; }
.login-brand strong { color: #111923; font-size: 2rem; line-height: 1; }
.login-brand span { color: var(--muted); margin-top: 8px; }
.login-form { display: grid; gap: 16px; }
.login-form label { color: #536171; display: grid; gap: 8px; font-size: .9rem; font-weight: 800; }
.login-form input { background: #fff; border: 1px solid #e1e9f2; border-radius: 12px; min-height: 58px; padding: 14px 16px; }
.password-field { display: grid; position: relative; }
.password-field input { padding-right: 86px; }
.password-field button { background: transparent; border: 0; color: var(--brand); cursor: pointer; font-size: .78rem; font-weight: 800; height: 100%; padding: 0 16px; position: absolute; right: 0; text-transform: uppercase; top: 0; }
.login-submit { border-radius: 12px; box-shadow: 0 18px 30px rgba(7,129,223,.24); font-size: .9rem; margin-top: 10px; min-height: 56px; }
.login-footer-note { color: var(--muted); font-size: .84rem; font-weight: 700; margin: 28px 0 0; text-align: center; }

@media (max-width: 980px) {
  .app-shell, .filters, .form-grid, .compact-config, .stats-grid, .details-grid, .report-grid, .module-strip { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; min-height: 0; }
  .login-visual { min-height: 360px; }
  .login-panel { padding: 30px; }
  .icon-rail { display: none; }
  .sidebar { height: auto; padding: 18px; position: static; }
  .workspace { padding: 16px; }
}

@media (max-width: 640px) {
  .login-page { padding: 12px; }
  .login-shell { border-radius: 18px; }
  .login-visual { min-height: 300px; padding: 24px; }
  .login-visual-copy h1 { font-size: 2rem; }
  .login-illustration { display: none; }
  .login-brand strong { font-size: 1.55rem; }
  .topbar, .action-panel, .panel-heading, .session, .toolbar, .inline-actions { align-items: stretch; flex-direction: column; }
}
