.admin-login-panel {
  --entry-ink: #162d53;
  --entry-blue: #2754c5;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(20px, 5vw, 80px);
  background: #edf1f6;
}
.admin-entry {
  width: min(100%, 900px);
  display: grid;
  grid-template-columns: .88fr 1.12fr;
  overflow: hidden;
  border: 1px solid #d4dce7;
  border-radius: 18px;
  background: white;
  box-shadow: 0 22px 70px -30px #21395745;
}
.entry-cover {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 486px;
  padding: clamp(32px, 4vw, 52px);
  background: linear-gradient(143deg, #172f63 2%, #254b9a 66%, #325db3);
  color: white;
}
.entry-identity { position: relative; z-index: 1; display: grid; gap: 8px; }
.entry-identity strong { font-size: clamp(24px, 2.4vw, 32px); line-height: 1.35; letter-spacing: .035em; }
.entry-identity span { color: #d7e4ff; font-size: 15px; }
.ballot-art { position: absolute; bottom: 11%; left: 50%; width: 256px; height: 245px; transform: translateX(-50%); }
.ballot-lid, .ballot-front, .ballot-side, .ballot-slot { position: absolute; inset: 0; }
.ballot-lid { background: #b8d3ff; clip-path: polygon(17% 49%, 96% 49%, 81% 65%, 2% 65%); }
.ballot-front { background: linear-gradient(110deg, #648fee, #4773d4); clip-path: polygon(2% 64.8%, 81.1% 64.8%, 81.1% 98%, 2% 98%); }
.ballot-side { background: #395fb3; clip-path: polygon(81% 65%, 96% 49%, 96% 82%, 81% 98%); }
.ballot-slot { background: #263e72; clip-path: polygon(24% 56%, 77% 56%, 74% 59%, 21% 59%); }
.ballot-paper-wrap { position: absolute; inset: 0; overflow: hidden; height: 57.5%; }
.ballot-paper {
  position: absolute; bottom: -12px; left: 32%; width: 42%; height: 118px;
  transform: rotate(-10deg); transform-origin: center bottom;
  background: #f8fbff; border-radius: 2px; box-shadow: 4px 4px 0 #1a387031;
}
.ballot-paper::before {
  content: ""; position: absolute; top: 17px; left: 15px; width: 24px; height: 24px;
  border: 2px solid #91a8d1; border-radius: 4px;
}
.ballot-paper i { position: absolute; top: 20px; left: 21px; width: 21px; height: 11px; border: solid #2856b9; border-width: 0 0 4px 4px; transform: rotate(-45deg); }
.ballot-paper::after { content: ""; position: absolute; top: 62px; left: 15px; width: 63%; height: 3px; background: #b7c9e2; box-shadow: 0 11px #d6e1f0; }
.entry-form-panel { min-width: 0; align-self: center; padding: 48px clamp(34px, 4.6vw, 66px); color: var(--entry-ink); }
.entry-form-panel h1 { font-size: clamp(28px, 2.5vw, 35px); line-height: 1.35; letter-spacing: -.02em; }
.entry-form-panel form { margin-top: 32px; }
.entry-field + .entry-field { margin-top: 20px; }
.entry-field label { display: block; margin-bottom: 8px; font-size: 14px; line-height: 1.5; font-weight: 600; }
.entry-field input {
  display: block; width: 100%; min-height: 48px; padding: 10px 14px;
  color: var(--entry-ink); font-size: 16px; line-height: 1.5;
  border: 1px solid #8798b0; border-radius: 7px; background: #fff;
}
.entry-field input:focus { outline: 2px solid var(--entry-blue); outline-offset: 1px; }
.entry-field input[aria-invalid="true"] { border-color: #ad3434; }
.entry-password { position: relative; }
.entry-password input { padding-right: 54px; }
#admin-password-toggle {
  position: absolute; inset: 2px 2px 2px auto; display: grid; place-items: center; width: 44px;
  background: transparent; color: #526783; border: 0; border-radius: 5px;
}
#admin-password-toggle svg { width: 21px; height: 21px; }
#admin-password-toggle .eye-slash { display: none; }
#admin-password-toggle[aria-pressed="true"] .eye-slash { display: block; }
#admin-login-feedback { font-size: 14px; line-height: 1.55; color: #a22c2c; overflow-wrap: anywhere; }
#admin-login-feedback:not(:empty) { margin-top: 13px; }
#admin-login-submit {
  display: block; width: 100%; min-height: 48px; margin-top: 28px; padding: 10px 16px;
  border: 0; border-radius: 7px; background: var(--entry-blue); color: white;
  font-size: 16px; line-height: 1.5; font-weight: 650;
}
#admin-login-submit:not(:disabled):active { background: #173b94; }
.entry-form-panel button:focus-visible { outline: 2px solid var(--entry-blue); outline-offset: 3px; }
@media (hover: hover) {
  #admin-password-toggle:hover { background: #edf2f9; }
  #admin-login-submit:not(:disabled):hover { background: #1c439f; }
}
@media (max-width: 700px) {
  .admin-login-panel { padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); }
  .admin-entry { max-width: 460px; grid-template-columns: minmax(0, 1fr); }
  .entry-cover { min-height: 130px; display: flex; align-items: center; padding: 26px; }
  .entry-identity strong { font-size: 22px; }
  .entry-identity span { font-size: 14px; }
  .ballot-art { left: auto; right: -4px; bottom: -16px; transform: scale(.52); transform-origin: right bottom; }
  .entry-form-panel { padding: 32px 26px 36px; }
  .entry-form-panel form { margin-top: 24px; }
}
.admin-body { background: #f4f6fa; }
.admin-layout { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; }
.admin-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px 20px; color: #d6dded; background: #18223b; }
.admin-brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 30px; }
.admin-brand .brand-mark { background: var(--primary); }
.admin-brand > div:last-child { display: flex; flex-direction: column; gap: 3px; }
.admin-brand strong { color: white; font-size: 14px; }
.admin-brand span { color: #78849f; font-size: 10px; letter-spacing: .12em; }
.admin-nav { display: flex; flex-direction: column; gap: 5px; }
.admin-nav button { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border: 0; border-radius: 10px; color: #9da8bf; background: transparent; text-align: left; font-size: 13px; font-weight: 600; transition: .18s; }
.admin-nav button svg { width: 19px; height: 19px; }
.admin-nav button:hover { color: white; background: rgba(255,255,255,.05); }
.admin-nav button.active { color: white; background: var(--primary); box-shadow: 0 8px 18px rgba(0,0,0,.15); }
.sidebar-bottom { margin-top: auto; }
.sidebar-live { display: flex; align-items: center; gap: 8px; margin: 0 12px 18px; color: #73809a; font-size: 10px; }
.sidebar-live i { width: 6px; height: 6px; border-radius: 50%; background: #3ed39e; }
.admin-profile { display: flex; align-items: center; gap: 9px; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.08); }
.admin-profile .avatar { color: #cbd6ff; background: rgba(100,132,255,.18); }
.admin-profile > div { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 3px; }
.admin-profile strong { color: #e8ecf5; font-size: 12px; }
.admin-profile span { color: #75819b; font-size: 10px; }
.admin-profile button { border: 0; color: #8490a9; background: transparent; font-size: 11px; }
.admin-main { min-width: 0; }
.admin-topbar { min-height: 98px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 34px; background: white; border-bottom: 1px solid var(--line); }
.admin-topbar .eyebrow { margin-bottom: 5px; }
.admin-topbar h1 { color: var(--ink); font-size: 24px; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: flex-end; gap: 12px; }
.topbar-actions .button { display: flex; align-items: center; gap: 8px; }
.topbar-actions .button svg { width: 18px; height: 18px; }
.export-filter { display: flex; flex-direction: column; gap: 5px; }
.export-filter span { color: var(--muted); font-size: 10px; }
.export-filter select, .compact-select, .filter-bar select { min-height: 40px; padding: 0 32px 0 12px; color: var(--text); background: white; border: 1px solid var(--line); border-radius: 9px; outline: none; font-size: 12px; }
.admin-content { max-width: 1540px; margin: 0 auto; padding: 28px 34px 50px; }
.overview-banner { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 25px 28px; margin-bottom: 20px; color: white; border-radius: 16px; background: linear-gradient(110deg, #2449c5, #3b64ee); }
.overview-banner h2 { margin-top: 12px; font-size: 23px; }
.overview-banner p { margin-top: 8px; color: rgba(255,255,255,.68); font-size: 12px; }
.overview-banner .status-pill { color: #dcfff2; background: rgba(37,211,156,.16); }
.overview-banner-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.overview-banner-meta span, .overview-banner-meta small { color: rgba(255,255,255,.55); font-size: 10px; }
.overview-banner-meta strong { font-size: 14px; }
.admin-metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 20px; }
.admin-metric { display: flex; align-items: center; gap: 15px; padding: 21px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.metric-icon { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 44px; border-radius: 12px; }
.metric-icon svg { width: 22px; height: 22px; }
.metric-icon.blue { color: #315efb; background: #edf2ff; }
.metric-icon.green { color: #07936a; background: #e9f8f2; }
.metric-icon.violet { color: #7753d7; background: #f2edff; }
.metric-icon.orange { color: #c47716; background: #fff4e4; }
.admin-metric > div { min-width: 0; }
.admin-metric div > span { display: block; color: var(--muted); font-size: 11px; }
.admin-metric strong { display: inline-block; margin: 4px 8px 3px 0; color: var(--ink); font-size: 27px; }
.admin-metric small { display: block; color: #9ca5b6; font-size: 10px; white-space: nowrap; }
.admin-two-column { display: grid; grid-template-columns: 1.08fr .92fr; gap: 20px; margin-bottom: 20px; }
.admin-card { min-width: 0; padding: 23px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.admin-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.admin-card-heading h3 { color: var(--ink); font-size: 15px; }
.admin-card-heading p { margin-top: 5px; color: var(--muted); font-size: 10px; }
.text-button { border: 0; color: var(--primary); background: transparent; font-size: 11px; }
.department-progress-item { padding: 13px 0; border-top: 1px solid #f0f2f6; }
.department-progress-item:first-child { padding-top: 0; border-top: 0; }
.department-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.department-progress-head strong { color: var(--ink); font-size: 12px; }
.department-progress-head span { color: var(--muted); font-size: 10px; }
.progress-track { height: 6px; background: #edf0f5; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #6c8bfa, #315efb); border-radius: 99px; }
.department-progress-meta { display: flex; justify-content: space-between; margin-top: 7px; color: #9aa3b5; font-size: 9px; }
.compact-select { min-height: 33px; max-width: 140px; }
.admin-result-row { padding: 11px 0; }
.admin-result-person { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; font-size: 11px; }
.admin-result-person strong { color: var(--ink); }
.admin-result-person span { color: var(--primary); font-weight: 700; }
.admin-result-row .result-track { height: 6px; }
.recent-card { padding-bottom: 12px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 11px 12px; color: #8e98aa; background: #f8f9fc; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 650; white-space: nowrap; }
td { padding: 14px 12px; color: #59657b; border-bottom: 1px solid #eff1f5; font-size: 11px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.table-person { display: flex; align-items: center; gap: 9px; min-width: 110px; }
.table-person .avatar { width: 31px; height: 31px; flex-basis: 31px; border-radius: 9px; font-size: 11px; }
.table-person strong { display: block; color: var(--ink); font-size: 12px; }
.table-person small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.table-tag { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 6px; color: #5c6c91; background: #f0f2f7; font-size: 9px; white-space: nowrap; }
.table-tag.success { color: #087a59; background: #e9f8f2; }
.table-tag.warning { color: #a7660b; background: #fff4e2; }
.table-tag.danger { color: #b64048; background: #ffedef; }
.table-tag.blue { color: #315efb; background: #edf2ff; }
.table-action { border: 0; color: var(--primary); background: transparent; padding: 4px; font-size: 10px; }
.table-action.danger { color: var(--danger); }
.cell-main { color: var(--ink); font-weight: 600; }
.cell-sub { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.cell-description { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-row { padding: 40px; color: var(--muted); text-align: center; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.panel-heading h2 { color: var(--ink); font-size: 20px; }
.panel-heading p { margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.panel-actions { display: flex; gap: 10px; }
.panel-actions .button { min-height: 40px; font-size: 12px; }
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.search-box { width: min(340px, 100%); min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: white; border: 1px solid var(--line); border-radius: 9px; }
.search-box svg { width: 17px; height: 17px; color: #9ca5b6; }
.search-box input { width: 100%; border: 0; outline: none; color: var(--ink); font-size: 12px; }
.table-card { padding: 10px 14px 0; }
.table-footer { padding: 13px 8px; color: var(--muted); border-top: 1px solid var(--line); font-size: 10px; }
.inline-form-card { margin-bottom: 18px; }
.inline-form { display: flex; align-items: flex-end; gap: 12px; }
.inline-form .field { min-width: 220px; margin: 0; }
.inline-form .grow { flex: 1; }
.inline-form .button { flex-shrink: 0; margin-bottom: 0; }
.department-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.department-card { padding: 22px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.department-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.department-card-header h3 { min-width: 0; color: var(--ink); font-size: 16px; overflow-wrap: anywhere; word-break: break-word; }
.department-card-header span { color: var(--primary); background: var(--primary-soft); padding: 5px 9px; border-radius: 7px; font-size: 10px; }
.department-card .field { margin-bottom: 12px; }
.department-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 16px 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.department-card-stats div { text-align: center; }
.department-card-stats strong { display: block; color: var(--ink); font-size: 18px; }
.department-card-stats span { color: var(--muted); font-size: 9px; }
.department-card .button { width: 100%; min-height: 38px; font-size: 11px; }
.department-card-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.department-card-actions .button-danger-outline { width: auto; color: var(--danger); background: white; border: 1px solid #efc6ca; }
.department-card-actions .button-danger-outline:hover { background: #fff3f4; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-status-card { padding: 22px; text-align: center; background: #f7f9fc; border-radius: 12px; }
.settings-status-card strong { display: block; margin: 12px 0 7px; color: var(--ink); font-size: 20px; }
.settings-status-card p { margin-bottom: 18px; color: var(--muted); font-size: 11px; }
.danger-zone { margin-top: 16px; padding: 14px; color: #8f661c; background: #fff8e9; border-radius: 9px; }
.danger-zone strong { font-size: 11px; }
.danger-zone p { margin-top: 5px; font-size: 10px; line-height: 1.6; }
.feature-list { margin: 0 0 20px; padding: 0; list-style: none; }
.feature-list li { position: relative; padding: 9px 0 9px 18px; color: #68748a; border-bottom: 1px solid #f0f2f6; font-size: 11px; }
.feature-list li::before { content: ""; position: absolute; left: 2px; top: 14px; width: 5px; height: 5px; background: var(--primary); border-radius: 50%; }
.admin-modal-card { width: min(650px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.modal-heading h3 { font-size: 20px; }
.modal-heading p { margin-top: 7px; color: var(--muted); font-size: 11px; }
.modal-close { border: 0; color: var(--muted); background: transparent; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 15px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; margin: 4px 0 18px; color: var(--text); font-size: 12px; }
.import-template { display: flex; flex-direction: column; gap: 7px; padding: 14px; margin-bottom: 17px; background: var(--primary-soft); border-radius: 9px; }
.import-template strong { color: var(--primary-dark); font-size: 11px; }
.import-template code { color: #5d6c96; font-size: 10px; }
.import-template span { color: #7986a7; font-size: 10px; }
.import-textarea { min-height: 150px !important; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.import-result { color: var(--muted); font-size: 11px; line-height: 1.7; }
.import-result .error-list { margin-top: 7px; color: var(--danger); }
.created-departments { max-height: 150px; margin-top: 10px; padding: 11px; overflow-y: auto; color: #23634f; background: #edf9f4; border-radius: 8px; overflow-wrap: anywhere; }
.created-departments strong { margin-bottom: 4px; }
.log-filter-card { display: grid; grid-template-columns: minmax(230px, 1.5fr) repeat(3, minmax(125px, .8fr)); gap: 12px; padding: 18px; margin-bottom: 16px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.log-search { width: 100%; align-self: end; }
.log-filter-field { display: flex; flex-direction: column; gap: 6px; }
.log-filter-field > span { color: var(--muted); font-size: 10px; }
.log-filter-field select, .log-filter-field input { width: 100%; min-height: 40px; padding: 0 10px; color: var(--text); background: white; border: 1px solid var(--line); border-radius: 9px; outline: none; font-size: 11px; }
.log-filter-actions { display: flex; align-items: flex-end; gap: 8px; }
.log-filter-actions .button { min-height: 40px; padding: 0 14px; font-size: 11px; white-space: nowrap; }
.log-table-card { padding-bottom: 0; }
.log-table { min-width: 1050px; }
.log-time { min-width: 145px; white-space: nowrap; }
.log-detail { max-width: 390px; }
.log-detail strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 11px; }
.log-detail span { display: block; line-height: 1.6; white-space: normal; word-break: break-word; }
.log-table-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 8px; color: var(--muted); border-top: 1px solid var(--line); font-size: 10px; }
.pagination { display: flex; align-items: center; gap: 12px; }
.pagination .button { min-height: 32px; padding: 0 11px; font-size: 10px; }
.pagination .button:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 1200px) {
  .log-filter-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-metric-grid { grid-template-columns: repeat(2, 1fr); }
  .department-card-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-two-column { grid-template-columns: 1fr; }
}

@media (max-width: 850px) {
  .admin-layout { display: block; }
  .admin-sidebar { position: static; width: 100%; height: auto; padding: 14px 16px; }
  .admin-brand { padding: 0 4px 14px; }
  .admin-nav { flex-direction: row; overflow-x: auto; padding-bottom: 3px; }
  .admin-nav button { flex: 0 0 auto; min-height: 38px; padding: 0 12px; }
  .admin-nav button svg { display: none; }
  .sidebar-bottom { display: none; }
  .admin-topbar { padding: 18px; }
  .admin-content { padding: 18px 14px 40px; }
  .topbar-actions { align-items: flex-end; }
  .export-filter { display: none; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form .field { min-width: 0; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .admin-topbar h1 { font-size: 20px; }
  .topbar-actions .button { padding: 0 13px; font-size: 11px; }
  .overview-banner { align-items: flex-start; flex-direction: column; padding: 20px; }
  .overview-banner-meta { align-items: flex-start; }
  .admin-metric-grid { gap: 9px; }
  .admin-metric { gap: 9px; padding: 15px 12px; }
  .metric-icon { width: 34px; height: 34px; flex-basis: 34px; }
  .admin-metric strong { font-size: 22px; }
  .admin-metric small { display: none; }
  .admin-card { padding: 17px 13px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-actions { width: 100%; }
  .panel-actions .button { flex: 1; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .department-card-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .table-card { padding: 6px 6px 0; }
  .log-filter-card { grid-template-columns: 1fr; padding: 14px; }
  .log-filter-actions .button { flex: 1; }
  .log-table-footer { align-items: flex-start; flex-direction: column; }
  .pagination { width: 100%; justify-content: space-between; }
}
