:root {
    color-scheme: light;
    --bg: #edf2f7;
    --panel: rgba(255, 255, 255, .88);
    --panel-solid: #ffffff;
    --text: #172033;
    --muted: #667085;
    --line: rgba(131, 149, 176, .28);
    --soft-line: rgba(131, 149, 176, .18);
    --primary: #0d7c75;
    --primary-dark: #075f5a;
    --primary-soft: #e4f7f4;
    --accent: #2563eb;
    --danger: #b42318;
    --danger-bg: #fff2f0;
    --ok: #16803c;
    --ok-bg: #eefaf1;
    --wait: #946200;
    --wait-bg: #fff6da;
    --shadow: 0 24px 70px rgba(23, 32, 51, .12);
    --shadow-soft: 0 12px 34px rgba(23, 32, 51, .08);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    min-height: 100%;
    margin: 0;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    color: var(--text);
    line-height: 1.5;
    background:
        radial-gradient(circle at 8% -10%, rgba(13, 124, 117, .18), transparent 34%),
        radial-gradient(circle at 92% 0%, rgba(37, 99, 235, .14), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 52%, #f6f8fb 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(15, 23, 42, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, .035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(180deg, rgba(0,0,0,.7), transparent 68%);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; color: var(--primary-dark); }

.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 34px;
    background: rgba(255, 255, 255, .78);
    border-bottom: 1px solid rgba(255,255,255,.7);
    box-shadow: 0 10px 30px rgba(23, 32, 51, .08);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0;
}

.brand::before {
    content: "";
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 10px 22px rgba(13, 124, 117, .24);
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.topbar nav a {
    color: #344054;
    border-radius: 999px;
    padding: 9px 13px;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.topbar nav a:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
    transform: translateY(-1px);
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1320px;
    margin: 34px auto 56px;
    padding: 0 24px;
}

.page-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

h1 {
    margin: 0;
    font-size: 32px;
    line-height: 1.18;
    letter-spacing: 0;
}

h2 {
    margin: 0 0 12px;
    font-size: 20px;
    letter-spacing: 0;
}

.panel, .auth-card {
    background: var(--panel);
    border: 1px solid rgba(255,255,255,.86);
    border-radius: 14px;
    padding: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.panel {
    position: relative;
    overflow: hidden;
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(13, 124, 117, .42), transparent);
}

.auth-card {
    max-width: 430px;
    margin: 88px auto;
}

.notice {
    background: rgba(228, 247, 244, .96);
    border: 1px solid rgba(13, 124, 117, .2);
    border-radius: 12px;
    padding: 13px 15px;
    margin-bottom: 18px;
    color: #155e59;
    box-shadow: var(--shadow-soft);
}

.tabs {
    display: inline-flex;
    gap: 5px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    background: rgba(255,255,255,.78);
    border: 1px solid rgba(255,255,255,.86);
    border-radius: 999px;
    padding: 5px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}

.tabs a, .button, button {
    border: 1px solid var(--line);
    background: rgba(255,255,255,.88);
    color: var(--text);
    border-radius: 999px;
    padding: 10px 15px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.tabs a {
    border: 0;
    color: var(--muted);
    padding: 9px 15px;
}

.tabs a.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 12px 24px rgba(13, 124, 117, .22);
}

.button:hover, button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(23, 32, 51, .1);
}

.primary, button.primary, .button.primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 14px 28px rgba(13, 124, 117, .24);
}

.primary:hover {
    color: #fff;
    filter: saturate(1.04) brightness(.98);
}

.search {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    background: rgba(255,255,255,.8);
    border: 1px solid rgba(255,255,255,.86);
    border-radius: 14px;
    padding: 12px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}

.search input { max-width: 430px; }

input, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 12px;
    font: inherit;
    background: rgba(255,255,255,.92);
    color: var(--text);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus, textarea:focus {
    outline: 0;
    border-color: rgba(13, 124, 117, .65);
    box-shadow: 0 0 0 4px rgba(13, 124, 117, .13);
    background: #fff;
}

textarea { resize: vertical; }

.form label {
    display: grid;
    gap: 8px;
    font-weight: 800;
    color: #344054;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 17px;
}

.wide { grid-column: 1 / -1; }

.quick-months {
    display: flex;
    align-items: end;
    gap: 8px;
}

.check {
    display: flex !important;
    grid-template-columns: auto 1fr !important;
    align-items: center;
    gap: 8px !important;
    font-weight: 600 !important;
}

.check input { width: auto; }

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 980px;
}

th, td {
    border-bottom: 1px solid var(--soft-line);
    padding: 14px 13px;
    text-align: left;
    vertical-align: middle;
}

th {
    position: sticky;
    top: 72px;
    z-index: 3;
    color: #526071;
    font-size: 13px;
    font-weight: 900;
    background: rgba(248, 250, 252, .96);
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

tbody tr {
    transition: transform .16s ease, box-shadow .16s ease;
}

tbody tr:hover td {
    background: #f7fbfb;
}

tbody tr:hover {
    transform: translateY(-1px);
}

tr.danger td { background: var(--danger-bg); }
tr.done td { background: var(--ok-bg); }

td:first-child a {
    font-weight: 900;
    color: #14213d;
}

.note {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #475467;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 900;
    color: var(--wait);
    background: var(--wait-bg);
}

.badge::before {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 4px rgba(148, 98, 0, .1);
}

.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.bad { color: var(--danger); background: var(--danger-bg); }

.row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.row-actions form { margin: 0; }

.link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    box-shadow: none;
}

.link:hover {
    transform: none;
    box-shadow: none;
}

.danger-link { color: var(--danger); }
.danger-button {
    background: linear-gradient(135deg, #b42318, #e11d48);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 14px 28px rgba(180, 35, 24, .2);
}
.danger-button:hover {
    color: #fff;
    filter: saturate(1.05) brightness(.98);
}
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 34px; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.detail-grid div {
    display: grid;
    gap: 5px;
    padding: 14px;
    border: 1px solid var(--soft-line);
    border-radius: 12px;
    background: rgba(255,255,255,.62);
}

.detail-grid span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.detail-grid strong {
    font-size: 16px;
    color: #1d2939;
}

.inline-form {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 180px minmax(200px, 1fr) auto;
    gap: 10px;
}

.import-panel {
    margin-bottom: 20px;
}

.import-panel p {
    max-width: 900px;
}

.template-box {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    padding: 14px;
    border: 1px dashed rgba(13, 124, 117, .34);
    background: linear-gradient(135deg, rgba(228, 247, 244, .66), rgba(239, 246, 255, .78));
    border-radius: 14px;
    margin: 14px 0;
}

.template-box code {
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 999px;
    padding: 7px 11px;
    color: #344054;
    box-shadow: 0 8px 18px rgba(23, 32, 51, .06);
}

.import-panel form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.import-panel input[type=file] {
    max-width: 460px;
    background: #fff;
}

.danger-zone {
    border-color: rgba(180, 35, 24, .2);
    background: rgba(255, 247, 246, .9);
}

.danger-zone::before {
    background: linear-gradient(90deg, transparent, rgba(180, 35, 24, .5), transparent);
}

.danger-zone input {
    max-width: 260px;
}

@media (max-width: 900px) {
    .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .topbar {
        min-height: auto;
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 16px 18px;
    }
    .topbar nav { width: 100%; }
    .container { margin-top: 24px; padding: 0 16px; }
    .page-title { align-items: flex-start; flex-direction: column; }
    h1 { font-size: 27px; }
    .grid-form, .detail-grid, .inline-form { grid-template-columns: 1fr; }
    .search { flex-direction: column; }
    .search input { max-width: none; }
    .actions { justify-content: flex-start; flex-wrap: wrap; }
    .import-panel form { align-items: stretch; flex-direction: column; }
    .import-panel input[type=file] { max-width: none; }
    th { top: 0; }
}
