* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: #0f1419; color: #e8edf5; }
a { color: #6ea8ff; text-decoration: none; }
.login-body { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: radial-gradient(1200px 600px at 20% 10%, #1c3b6a 0%, #0f1419 55%); }
.login-card { width: 100%; max-width: 380px; background: #171e27; padding: 36px; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-card h1 { margin: 0; font-size: 24px; }
.login-card .sub { color: #8b98a8; margin: 6px 0 24px; }
.login-card label, .form label { display: block; margin: 12px 0 6px; color: #b7c2d0; font-size: 13px; }
.login-card input, .form input, .form select, .search input, .inline-form input, .inline-form select { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid #2a3544; background: #10161d; color: #fff; font-size: 16px; }
button { background: #3b8ff6; color: #fff; border: 0; border-radius: 8px; padding: 12px 16px; cursor: pointer; font-size: 15px; }
.login-card button { width: 100%; margin-top: 18px; min-height: 44px; }
.alert { background: #4a1f27; color: #ff8a9a; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.ok { background: #16351f; color: #6ee7a0; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.layout { display: flex; min-height: 100vh; min-height: 100dvh; }
aside { width: 220px; background: #121820; padding: 24px 16px; padding-top: max(24px, env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.brand { font-weight: 700; margin-bottom: 16px; font-size: 18px; }
aside a { color: #c5d0dc; padding: 10px 12px; border-radius: 8px; min-height: 44px; display: flex; align-items: center; }
aside a.on, aside a:hover { background: #1c2733; color: #fff; }
main { flex: 1; padding: 32px; padding-bottom: max(32px, env(safe-area-inset-bottom)); min-width: 0; }
.page-head h2 { margin: 0; font-size: 22px; }
.page-head p { color: #8b98a8; margin: 8px 0 20px; line-height: 1.6; }
.card { background: #171e27; padding: 24px; border-radius: 14px; max-width: 760px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.switch { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; line-height: 1.5; }
.switch input { width: auto; min-width: 18px; min-height: 18px; margin-top: 3px; }
.search { display: flex; gap: 8px; margin-bottom: 16px; max-width: 520px; }
.search input { flex: 1; min-width: 0; }
.search button { flex-shrink: 0; min-height: 44px; }
.table-wrap { overflow: auto; background: #171e27; border-radius: 14px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 14px; border-bottom: 1px solid #243040; text-align: left; vertical-align: top; }
th { color: #8b98a8; font-weight: 600; white-space: nowrap; }
.name { font-weight: 600; }
.muted { color: #7d8b9a; font-size: 12px; margin-top: 4px; word-break: break-all; }
.empty { text-align: center; color: #8b98a8; padding: 40px !important; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.tag.paid { background: #16351f; color: #6ee7a0; }
.tag.unpaid { background: #3a2a12; color: #fbbf24; }
.tag.overdue { background: #4a1f27; color: #ff8a9a; }
.tag.disabled { background: #2a3544; color: #c5d0dc; }
.inline-form { display: inline-flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; min-width: 120px; }
.edit-row td { background: #121820; }
.danger button { background: #b42318; }
.link { color: #6ea8ff; display: inline-block; padding: 6px 0; }

@media (max-width: 860px) {
    .layout { flex-direction: column; }
    aside { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px 12px 12px; padding-top: max(12px, env(safe-area-inset-top)); padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); position: sticky; top: 0; z-index: 20; }
    .brand { width: 100%; margin: 0 0 4px; font-size: 16px; }
    aside a { padding: 8px 12px; font-size: 14px; min-height: 40px; }
    main { padding: 16px 12px 24px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
    .page-head h2 { font-size: 20px; }
    .page-head p { font-size: 13px; }
    .card { padding: 16px; }
    .form .row { grid-template-columns: 1fr; gap: 0; }
    .search { max-width: none; flex-direction: column; }
    .search button { width: 100%; }
    .login-card { padding: 24px 20px; }
    .login-card h1 { font-size: 22px; }
    .table-wrap { background: transparent; overflow: visible; }
    table { border: 0; }
    thead { display: none; }
    tbody tr { display: block; background: #171e27; border-radius: 12px; margin-bottom: 12px; padding: 12px 14px; }
    tbody td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border: 0; padding: 8px 0; border-bottom: 1px solid #243040; }
    tbody td:last-child { border-bottom: 0; }
    tbody td::before { content: attr(data-label); color: #8b98a8; font-size: 12px; flex: 0 0 76px; padding-top: 2px; }
    tbody td.empty { display: block; text-align: center; padding: 32px 12px !important; }
    tbody td.empty::before { content: none; }
    tbody tr.edit-row { margin-top: -6px; background: #121820; }
    tbody tr.edit-row td { display: block; }
    tbody tr.edit-row td::before { display: none; }
    .inline-form { display: flex; flex-direction: column; align-items: stretch; width: 100%; }
    .inline-form label { width: 100%; }
    .inline-form input, .inline-form select, .inline-form button { width: 100%; }
    .inline-form button { min-height: 44px; }
}
