:root {
  --blue-950: #092b6a;
  --blue-900: #0b3f96;
  --blue-800: #114ea8;
  --blue-700: #1767ca;
  --blue-100: #eaf2ff;
  --blue-50: #f4f8ff;
  --red: #e11b22;
  --ink: #10213f;
  --muted: #66748d;
  --line: #dbe4f1;
  --bg: #eef4fc;
  --white: #fff;
  --shadow: 0 18px 50px rgba(23, 55, 103, .10);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 14px;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 28px;
  background:
    radial-gradient(circle at 14% 15%, rgba(25,102,202,.12), transparent 27%),
    radial-gradient(circle at 88% 88%, rgba(225,27,34,.06), transparent 24%),
    linear-gradient(145deg, #f7faff, #edf3fc 58%, #f7f3f5);
}
.login-card {
  width: min(100%, 520px); padding: 42px 42px 30px; border-radius: 28px; background: rgba(255,255,255,.96); box-shadow: 0 30px 80px rgba(31,64,114,.14); border: 1px solid rgba(255,255,255,.8); text-align: center;
}
.login-logo { width: 106px; height: 106px; object-fit: contain; margin-bottom: 14px; }
.login-card h1 { margin: 0; color: var(--blue-900); font-size: clamp(2rem, 5vw, 2.7rem); letter-spacing: -.035em; }
.login-subtitle { color: var(--muted); margin: 8px 0 28px; font-size: .95rem; }
.login-card form { text-align: left; }
.field-label { display: block; font-weight: 750; margin: 0 0 8px; font-size: .92rem; }
.input { width: 100%; min-height: 50px; border: 1px solid #ccd8ea; border-radius: 13px; background: #f8fbff; padding: 0 14px; color: var(--ink); outline: none; transition: .2s ease; }
.input:focus { border-color: var(--blue-700); box-shadow: 0 0 0 4px rgba(23,103,202,.11); background: white; }
.login-card .input { margin-bottom: 18px; background: #edf4ff; }
.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 760; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--blue-900), var(--blue-700)); color: white; box-shadow: 0 10px 24px rgba(17,78,168,.18); }
.btn-secondary { background: white; color: var(--blue-900); border: 1px solid #bfd0e8; }
.btn-danger { background: #fff1f1; color: #b5151b; border: 1px solid #f1b7ba; }
.btn-block { width: 100%; margin-top: 4px; }
.btn-small { min-height: 36px; padding: 8px 12px; border-radius: 9px; font-size: .84rem; }
.motto { color: var(--blue-900); font-weight: 800; margin: 20px 0 14px; letter-spacing: .02em; }
.login-copyright { color: var(--muted); font-size: .78rem; line-height: 1.55; }
.alert { border-radius: 12px; padding: 12px 14px; margin: 0 0 18px; text-align: left; font-size: .9rem; }
.alert-error { background: #fff0f1; border: 1px solid #f5c3c6; color: #9f151b; }
.alert-success { background: #effaf5; border: 1px solid #bce5d1; color: #17643e; }

.app-body { min-height: 100vh; background: linear-gradient(145deg, #f2f6fd, #edf3fb 64%, #f8f1f3); }
.topbar { position: sticky; top: 0; z-index: 30; height: 70px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 9px 24px; backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 48px; height: 48px; object-fit: contain; flex: 0 0 auto; }
.brand span { min-width: 0; }
.brand strong { display: block; color: var(--blue-900); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; color: var(--muted); font-size: .74rem; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-pill { margin-left: auto; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px 8px 16px; background: white; font-size: .82rem; }
.account-pill a { color: var(--red); font-weight: 800; }
.icon-button { border: 0; background: transparent; font-size: 1.4rem; }
.mobile-menu-button { display: none; }
.app-shell { display: grid; grid-template-columns: 255px minmax(0, 1fr); min-height: calc(100vh - 70px); }
.sidebar { padding: 20px 16px; }
.sidebar nav { position: sticky; top: 90px; background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 20px; padding: 16px 12px; box-shadow: 0 14px 36px rgba(31,64,114,.06); }
.nav-caption { font-size: .7rem; font-weight: 850; letter-spacing: .14em; color: #6b7890; padding: 4px 10px 8px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 11px; font-size: .88rem; font-weight: 720; color: #26364f; margin: 2px 0; }
.nav-link span { width: 20px; font-size: 1.1rem; color: #334158; }
.nav-link:hover { background: #f2f6fd; }
.nav-link.active { background: var(--blue-100); color: var(--blue-900); box-shadow: inset 3px 0 0 var(--blue-800); }
.nav-link.active span { color: var(--blue-900); }
.nav-divider { height: 1px; background: var(--line); margin: 12px 8px; }
.content { min-width: 0; padding: 20px 24px 0; display: flex; flex-direction: column; }
.hero-card { background: linear-gradient(115deg, rgba(255,255,255,.94), rgba(247,250,255,.92) 70%, rgba(255,244,246,.72)); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 32px; box-shadow: 0 14px 38px rgba(31,64,114,.05); margin-bottom: 18px; }
.hero-card.compact { padding: 26px 30px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--red); font-size: .75rem; font-weight: 900; letter-spacing: .15em; }
.eyebrow::before { content: ''; width: 28px; height: 2px; background: var(--red); }
.hero-card h1 { color: var(--blue-900); margin: 10px 0 4px; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.04em; line-height: 1.05; }
.hero-card p { color: var(--muted); max-width: 850px; margin: 10px 0 0; line-height: 1.55; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.feature-card { min-height: 190px; display: grid; grid-template-columns: 58px 1fr auto; gap: 16px; align-items: center; background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 22px; padding: 26px; box-shadow: var(--shadow); transition: transform .18s ease, border .18s ease; }
.feature-card:hover { transform: translateY(-3px); border-color: #b8cae6; }
.feature-icon { width: 58px; height: 58px; border-radius: 17px; background: var(--blue-100); display: grid; place-items: center; color: var(--blue-900); font-size: 1.8rem; font-weight: 700; }
.feature-card h2 { margin: 0 0 6px; color: var(--blue-900); font-size: 1.45rem; }
.feature-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.feature-arrow { color: var(--blue-700); font-size: 1.6rem; }
.info-strip { margin-top: 18px; background: #f7fbff; border: 1px solid #ccddf2; border-radius: 15px; padding: 14px 16px; color: #53637c; font-size: .88rem; }
.panel { background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: 0 12px 32px rgba(31,64,114,.05); margin-bottom: 18px; }
.panel::before { content: ''; display: block; height: 3px; margin: -24px -24px 20px; border-radius: 20px 20px 0 0; background: linear-gradient(90deg, var(--blue-800), #5b3d8f 56%, var(--red)); }
.panel h2 { margin: 0; color: var(--blue-900); font-size: 1.35rem; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.muted { color: var(--muted); margin: 5px 0 0; font-size: .9rem; }
.status-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 7px 11px; background: #edf3fb; color: #58677e; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.status-badge.success { background: #e9f8f0; color: #14623d; }
.status-badge.warning { background: #fff6e6; color: #8a5d09; }
.route-current { border: 1px dashed #bfd0e7; border-radius: 16px; background: var(--blue-50); padding: 18px; display: flex; align-items: center; gap: 14px; margin: 12px 0 20px; }
.route-icon { width: 50px; height: 50px; border-radius: 14px; background: white; display: grid; place-items: center; font-size: 1.5rem; box-shadow: 0 7px 18px rgba(31,64,114,.07); }
.route-current strong, .route-current small { display: block; }
.route-current strong { margin: 3px 0; color: var(--blue-900); word-break: break-all; }
.route-current small { color: var(--muted); }
.small-label { color: var(--muted); font-size: .78rem; font-weight: 700; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.browser-note { margin-top: 18px; color: #63718a; font-size: .84rem; line-height: 1.5; }
.search-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.search-box-wrap { position: relative; }
.search-box-wrap > span { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--blue-800); font-size: 1.2rem; }
.search-input { width: 100%; min-height: 56px; border: 1px solid #c6d5e9; border-radius: 14px; padding: 0 18px 0 44px; font-size: 1rem; outline: none; background: white; }
.search-input:focus { border-color: var(--blue-700); box-shadow: 0 0 0 4px rgba(23,103,202,.10); }
.search-input:disabled { background: #f4f6f9; }
.search-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .82rem; margin: 10px 2px 18px; }
.permission-box { border: 1px solid #cbdaf0; background: #f5f9ff; border-radius: 15px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.permission-box strong { color: var(--blue-900); }
.permission-box p { margin: 4px 0 0; color: var(--muted); font-size: .85rem; }
.hidden { display: none !important; }
.results-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; border-top: 1px solid #e5ebf4; padding-top: 18px; }
.results-heading h2 { margin: 0; }
.results-area { margin-top: 12px; display: grid; gap: 10px; }
.empty-state { min-height: 230px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); border: 1px dashed #cbd7e8; border-radius: 16px; padding: 26px; background: #fbfdff; }
.empty-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-100); color: var(--blue-900); font-size: 1.5rem; }
.empty-state h3 { margin: 10px 0 2px; color: var(--blue-900); }
.empty-state p { margin: 0; }
.result-card { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid #dce5f1; border-radius: 14px; background: white; }
.result-card:hover { border-color: #b6c9e5; background: #fcfdff; }
.pdf-badge { width: 48px; height: 48px; border-radius: 12px; background: #fff0f1; color: #c91a20; display: grid; place-items: center; font-size: .72rem; font-weight: 900; }
.result-main { min-width: 0; }
.result-main h3 { margin: 0 0 5px; color: #173b79; font-size: .96rem; word-break: break-word; }
.result-main p { margin: 0; color: var(--muted); font-size: .82rem; word-break: break-word; }
.result-main p span { font-weight: 800; color: #526078; }
.result-actions { display: flex; gap: 8px; }
.result-limit { text-align: center; color: var(--muted); padding: 10px; font-size: .82rem; }
.file-picker-label { cursor: pointer; }
.admin-grid { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(0, 1.7fr); gap: 18px; align-items: start; }
.stack-form { margin-top: 18px; }
.stack-form .input { margin-bottom: 14px; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 2px 0 16px; color: var(--muted); font-size: .88rem; }
.responsive-table-wrap { width: 100%; overflow-x: auto; border: 1px solid #e0e7f1; border-radius: 13px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 700px; }
.data-table th { text-align: left; font-size: .75rem; letter-spacing: .04em; color: #66738a; background: #f6f9fd; padding: 12px; border-bottom: 1px solid #dde6f1; }
.data-table td { padding: 12px; border-bottom: 1px solid #edf1f6; vertical-align: top; font-size: .85rem; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td small { display: block; color: var(--muted); margin-top: 3px; }
.actions-cell { display: flex; gap: 7px; align-items: center; }
.actions-cell form { margin: 0; }
.dot-status { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 800; }
.dot-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #abb5c4; }
.dot-status.on { color: #14623d; }.dot-status.on::before { background: #28a56b; }
.dot-status.off { color: #7a6470; }.dot-status.off::before { background: #c597a7; }
.filter-grid { display: grid; grid-template-columns: 1.2fr 1fr .8fr .8fr auto; gap: 12px; align-items: end; }
.filter-actions { display: flex; gap: 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 17px; box-shadow: 0 10px 28px rgba(31,64,114,.04); }
.stat-card span { display: block; color: var(--muted); font-size: .78rem; }
.stat-card strong { display: block; color: var(--blue-900); font-size: 1.8rem; margin-top: 4px; }
.activity-tag { display: inline-flex; border-radius: 999px; padding: 6px 9px; background: #eef4ff; color: #174c9e; font-weight: 800; font-size: .72rem; white-space: nowrap; }
.table-empty { text-align: center; color: var(--muted); padding: 34px !important; }
.app-footer { margin-top: auto; padding: 26px 12px 18px; text-align: center; color: #68768c; font-size: .74rem; }

@media (max-width: 1100px) {
  .admin-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-actions { grid-column: 1 / -1; }
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .mobile-menu-button { display: inline-flex; }
  .brand small { display: none; }
  .account-pill span { display: none; }
  .topbar { padding: 9px 14px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; top: 70px; left: 0; bottom: 0; width: min(86vw, 300px); padding: 12px; transform: translateX(-105%); transition: transform .22s ease; background: rgba(236,243,252,.98); }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 60px rgba(16,33,63,.16); }
  .sidebar nav { position: static; }
  .content { padding: 16px 14px 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .feature-card { min-height: 150px; }
  .search-head { grid-template-columns: 1fr; }
  .result-card { grid-template-columns: 46px minmax(0, 1fr); }
  .result-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .login-body { padding: 14px; }
  .login-card { padding: 30px 20px 24px; border-radius: 22px; }
  .login-logo { width: 90px; height: 90px; }
  .brand img { width: 42px; height: 42px; }
  .brand strong { font-size: .9rem; max-width: 190px; }
  .hero-card, .hero-card.compact { padding: 22px 18px; border-radius: 20px; }
  .hero-card h1 { font-size: 2rem; }
  .panel { padding: 18px; border-radius: 18px; }
  .panel::before { margin: -18px -18px 18px; }
  .feature-card { grid-template-columns: 50px 1fr; padding: 20px; }
  .feature-icon { width: 50px; height: 50px; }
  .feature-arrow { display: none; }
  .permission-box { align-items: stretch; flex-direction: column; }
  .button-row .btn { flex: 1 1 auto; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-actions { grid-column: auto; flex-wrap: wrap; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card strong { font-size: 1.5rem; }
}
