:root {
  --ink: #172033;
  --muted: #6e7a8e;
  --soft: #f3f6fa;
  --line: #e1e6ed;
  --blue: #155eef;
  --blue-dark: #0c3788;
  --green: #087443;
  --red: #c42b3b;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f3f5f8; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(440px, 1.04fr) minmax(420px, .96fr); background: #fff; }
.login-panel { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: 42px 58px 72px; overflow: hidden; color: #fff; background: linear-gradient(145deg, #071d4b 0%, #0d3c91 55%, #155eef 100%); }
.login-panel::before { content: ""; position: absolute; width: 620px; height: 620px; right: -230px; top: -210px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; box-shadow: 0 0 0 85px rgba(255,255,255,.035), 0 0 0 170px rgba(255,255,255,.025); }
.login-panel::after { content: ""; position: absolute; inset: 0; opacity: .1; background-image: linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(to bottom, transparent, #000); }
.login-brand, .login-copy { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .logo { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.5); border-radius: 11px; background: rgba(255,255,255,.13); font-family: "STSong", "SimSun", serif; font-size: 22px; }
.login-brand strong, .login-brand span { display: block; }
.login-brand strong { font-size: 16px; letter-spacing: .08em; }
.login-brand span { margin-top: 2px; color: rgba(255,255,255,.62); font-size: 8px; letter-spacing: .18em; }
.login-copy { max-width: 570px; }
.kicker, .form-kicker { margin: 0 0 12px; color: #80afff; font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.login-copy h1 { margin: 0 0 22px; font-family: "STSong", "SimSun", serif; font-size: clamp(42px, 5vw, 68px); line-height: 1.16; letter-spacing: .07em; }
.login-copy > p:not(.kicker) { max-width: 500px; margin: 0; color: rgba(255,255,255,.72); font-size: 15px; line-height: 1.9; }
.feature-pills { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 30px; }
.feature-pills span { padding: 7px 11px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; color: rgba(255,255,255,.76); background: rgba(255,255,255,.07); font-size: 11px; }
.login-form-wrap { display: grid; place-items: center; padding: 36px; }
.login-form { width: min(100%, 390px); }
.login-form .form-kicker { color: var(--blue); }
.login-form h2 { margin: 0; font-size: 29px; }
.form-hint { margin: 9px 0 33px; color: var(--muted); font-size: 13px; }
label { display: block; color: #445168; font-size: 13px; font-weight: 650; }
label + label { margin-top: 18px; }
label em { color: #e5484d; font-style: normal; }
input, select { width: 100%; height: 43px; margin-top: 7px; padding: 0 13px; border: 1px solid #d7dde6; border-radius: 8px; outline: none; color: #1d293d; background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { border-color: #6191f7; box-shadow: 0 0 0 3px rgba(21,94,239,.1); }
input::placeholder { color: #a8b0bf; }
label small { display: block; margin-top: 6px; color: #8a95a6; font-weight: 400; }
.form-error { min-height: 20px; margin: 12px 0; color: #c42b3b; font-size: 12px; }
.primary, .secondary { min-height: 40px; padding: 0 16px; border-radius: 8px; font-weight: 700; transition: .15s ease; }
.primary { border: 1px solid var(--blue); color: #fff; background: var(--blue); box-shadow: 0 6px 14px rgba(21,94,239,.14); }
.primary:hover { background: #0e4cd0; }
.primary:disabled { opacity: .55; cursor: wait; }
.secondary { border: 1px solid #d8dee8; color: #425069; background: #fff; }
.secondary:hover { border-color: #aab5c5; background: #f9fafb; }
.wide { width: 100%; height: 46px; }

.app-view { min-height: 100vh; }
.app-header { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1240px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.app-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.app-brand > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: linear-gradient(145deg, var(--blue-dark), var(--blue)); font-family: "STSong", "SimSun", serif; font-size: 20px; }
.app-brand strong, .app-brand small { display: block; }
.app-brand strong { font-size: 15px; }
.app-brand small { margin-top: 1px; color: #909aad; font-size: 10px; }
.app-header nav { display: flex; align-items: center; gap: 15px; color: var(--muted); font-size: 12px; }
.text-button { padding: 0; border: 0; color: #526078; background: transparent; font-size: 12px; }
.text-button:hover { color: var(--blue); }
.danger-text:hover { color: var(--red); }
.content { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 60px; }
.page-title { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.page-title .kicker { margin-bottom: 7px; color: var(--blue); }
.page-title h1 { margin: 0; font-family: "STSong", "SimSun", serif; font-size: 32px; letter-spacing: .07em; }
.page-title p:not(.kicker) { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.page-title button span { margin-right: 4px; font-size: 18px; font-weight: 400; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 30px 0 18px; }
.summary-grid article { position: relative; overflow: hidden; padding: 20px 22px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.summary-grid article::after { content: ""; position: absolute; width: 80px; height: 80px; right: -25px; top: -28px; border-radius: 50%; background: #edf4ff; }
.summary-grid p, .summary-grid span { margin: 0; color: var(--muted); font-size: 11px; }
.summary-grid strong { display: block; margin: 7px 0 6px; color: #24324c; font-size: 25px; }
.summary-grid .status-ok { display: flex; align-items: center; gap: 8px; color: var(--green); font-size: 21px; }
.status-ok i { width: 8px; height: 8px; border-radius: 50%; background: #12b76a; box-shadow: 0 0 0 4px rgba(18,183,106,.13); }
.data-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.toolbar { display: flex; gap: 10px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.search-box { position: relative; flex: 1; max-width: 520px; }
.search-box span { position: absolute; left: 13px; top: 12px; color: #8d98aa; font-size: 18px; }
.search-box input { height: 40px; margin: 0; padding-left: 38px; background: #fafbfd; }
.toolbar select { width: 130px; height: 40px; margin: 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 13px 16px; color: #788498; background: #fafbfd; font-size: 11px; font-weight: 700; text-align: left; white-space: nowrap; }
td { padding: 16px; border-top: 1px solid #edf0f4; color: #425069; font-size: 13px; vertical-align: middle; }
tbody tr:hover { background: #fcfdff; }
.voucher-cell strong, .voucher-cell small { display: block; }
.voucher-cell strong { color: #26344d; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.voucher-cell small { max-width: 260px; margin-top: 5px; color: #8792a4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.badge.active { color: var(--green); background: #ecfdf3; }
.badge.active::before { background: #12b76a; }
.badge.void { color: #8b4550; background: #fff0f1; }
.badge.void::before { background: #d14351; }
.actions-head { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; min-width: 236px; }
.row-actions button, .row-actions a { height: 30px; display: inline-flex; align-items: center; padding: 0 9px; border: 1px solid #dfe4eb; border-radius: 6px; color: #526078; background: #fff; font-size: 11px; font-weight: 650; text-decoration: none; }
.row-actions button:hover, .row-actions a:hover { border-color: #a7b4c7; color: var(--blue); }
.row-actions .void-action:hover { border-color: #eca9af; color: var(--red); }
.empty-state { padding: 70px 20px; text-align: center; }
.empty-state div { color: #9ba7b9; font-size: 32px; }
.empty-state strong { display: block; margin: 7px 0; font-size: 15px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 12px; }
.pagination { min-height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 10px 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pagination > div { display: flex; gap: 7px; }
.small { min-height: 34px; padding: 0 12px; font-size: 11px; }
.small:disabled { opacity: .45; cursor: default; }

.modal-layer { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(8, 17, 35, .54); backdrop-filter: blur(5px); }
.modal-card { width: min(100%, 470px); max-height: calc(100vh - 48px); overflow-y: auto; border-radius: 13px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.24); }
.modal-card.large { width: min(100%, 700px); }
.modal-card > header { position: sticky; z-index: 1; top: 0; display: flex; align-items: start; justify-content: space-between; padding: 23px 25px 17px; border-bottom: 1px solid var(--line); background: #fff; }
.modal-card .form-kicker { margin-bottom: 6px; color: var(--blue); }
.modal-card h2 { margin: 0; font-size: 20px; }
.icon-button { width: 32px; height: 32px; border: 0; border-radius: 7px; color: #7f8a9c; background: #f4f6f8; font-size: 21px; }
.modal-card form { padding: 22px 25px 25px; }
.form-section-title { display: flex; align-items: center; gap: 9px; margin: 5px 0 13px; }
.form-section-title:not(:first-child) { margin-top: 25px; }
.form-section-title span { color: var(--blue); font-size: 10px; font-weight: 850; }
.form-section-title strong { font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid label + label { margin-top: 0; }
.form-grid .full { grid-column: 1 / -1; }
.modal-card footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: 380px; padding: 13px 17px; border-radius: 9px; color: #fff; background: #172033; box-shadow: 0 14px 35px rgba(0,0,0,.2); font-size: 13px; }
.toast.error { background: #a92837; }

@media (max-width: 820px) {
  .login-view { grid-template-columns: 1fr; }
  .login-panel { min-height: 230px; padding: 28px; }
  .login-copy { margin-top: 46px; }
  .login-copy h1 { margin-bottom: 10px; font-size: 34px; }
  .login-copy > p:not(.kicker), .feature-pills { display: none; }
  .login-form-wrap { padding: 42px 24px; }
  .app-header { padding: 0 18px; }
  #currentUser { display: none; }
  .content { width: min(100% - 24px, 1240px); padding-top: 28px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-grid article:last-child { display: none; }
  .toolbar { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; max-width: none; }
  .toolbar select { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .modal-layer { padding: 10px; }
  .modal-card { max-height: calc(100vh - 20px); }
}

@media (max-width: 520px) {
  .page-title { align-items: flex-start; }
  .page-title h1 { font-size: 27px; }
  .page-title > div > p:not(.kicker) { display: none; }
  .page-title button { min-width: 116px; padding: 0 12px; }
  .app-brand small, #passwordButton { display: none; }
  .summary-grid article { padding: 16px; }
  .modal-card > header, .modal-card form { padding-left: 18px; padding-right: 18px; }
}

