:root {
    --sidebar-width: 282px;
    --sidebar-padding-x: 18px;
    --content-gutter: 28px;
    --topbar-offset: 150px;
    --bg: #f3efe7;
    --bg-strong: #ece5da;
    --paper: rgba(255, 252, 247, 0.88);
    --paper-strong: #fffdf8;
    --paper-soft: rgba(255, 249, 241, 0.66);
    --line: rgba(33, 58, 76, 0.12);
    --line-strong: rgba(33, 58, 76, 0.2);
    --text: #1a3141;
    --text-soft: #667887;
    --nav: #10293b;
    --nav-deep: #0a1d2a;
    --accent: #1d7667;
    --accent-strong: #124f58;
    --danger: #b25149;
    --shadow: 0 28px 68px rgba(13, 33, 48, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(200, 154, 90, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(29, 118, 103, 0.1), transparent 30%),
        linear-gradient(180deg, #f7f3ea 0%, #f1ece2 100%);
    font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

body::before,
body::after {
    content: "";
    position: fixed;
    pointer-events: none;
    z-index: 0;
    border-radius: 999px;
}

body::before {
    left: 3%;
    bottom: 12%;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(200, 154, 90, 0.12) 0%, transparent 66%);
}

body::after {
    top: 8%;
    right: 4%;
    width: 340px;
    height: 340px;
    background: radial-gradient(circle, rgba(29, 118, 103, 0.11) 0%, transparent 68%);
}

a {
    color: var(--accent-strong);
    text-decoration: none;
    transition: color 0.18s ease, transform 0.18s ease;
}

a:hover {
    color: var(--accent);
}

.app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: block;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    padding: 0;
    color: rgba(247, 250, 252, 0.92);
    background:
        radial-gradient(circle at top right, rgba(200, 154, 90, 0.18), transparent 30%),
        linear-gradient(180deg, #17384e 0%, #10293b 42%, #0a1d2a 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.sidebar::before,
.sidebar::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.sidebar::before {
    top: -72px;
    right: -72px;
    width: 180px;
    height: 180px;
    background: rgba(200, 154, 90, 0.18);
    filter: blur(18px);
}

.sidebar::after {
    left: -96px;
    bottom: -96px;
    width: 220px;
    height: 220px;
    background: rgba(29, 118, 103, 0.18);
    filter: blur(24px);
}

.sidebar-brand {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    padding: 26px var(--sidebar-padding-x) 14px;
}

.sidebar-scroll {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px calc(var(--sidebar-padding-x) - 2px) 22px var(--sidebar-padding-x);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-scroll::-webkit-scrollbar {
    display: none;
}

.brand-link {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: #fff;
}

.brand-link:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.brand-mark {
    flex: 0 0 62px;
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 250, 243, 0.98), rgba(247, 239, 226, 0.94));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.78),
        0 12px 24px rgba(9, 24, 36, 0.18);
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 2px;
    filter: drop-shadow(0 8px 12px rgba(13, 25, 38, 0.15));
}

.brand-copy {
    min-width: 0;
}

.brand-title {
    display: block;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.brand-subtitle {
    display: block;
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-heading {
    position: relative;
    z-index: 1;
    margin: 0 10px 12px;
    color: rgba(255, 255, 255, 0.54);
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.nav {
    position: relative;
    z-index: 1;
}

.nav a {
    position: relative;
    display: block;
    margin-bottom: 8px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: rgba(246, 250, 252, 0.9);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    overflow: hidden;
}

.nav a::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    border-radius: 999px;
    background: transparent;
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.nav a:hover,
.nav a.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
    border-color: rgba(255, 255, 255, 0.08);
}

.nav a:hover::before,
.nav a.active::before {
    background: linear-gradient(180deg, #f6d1a0 0%, #d7a567 100%);
    box-shadow: 0 0 18px rgba(246, 209, 160, 0.42);
}

.sidebar-note {
    position: relative;
    z-index: 1;
    margin: 18px 0 0;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.main {
    min-width: 0;
    margin-left: var(--sidebar-width);
    padding: 0 var(--content-gutter) 28px;
}

.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    padding: 20px var(--content-gutter) 0;
    z-index: 45;
    margin-bottom: 0;
}

.topbar-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border: 1px solid rgba(255, 255, 255, 0.64);
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 252, 247, 0.84));
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.content {
    padding-top: var(--topbar-offset);
}

.topbar-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.topbar-eyebrow,
.page-eyebrow {
    color: var(--text-soft);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.topbar-copy strong {
    font-size: clamp(20px, 2.3vw, 30px);
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.topbar-subtitle {
    color: var(--text-soft);
    font-size: 13px;
}

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

.todo-shortcut {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid rgba(17, 44, 60, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(13, 33, 48, 0.06);
}

.todo-shortcut:hover {
    color: var(--text);
}

.todo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: #d94a4a;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.todo-badge.is-hidden {
    display: none;
}

.topbar-actions form {
    margin: 0;
}

.user-chip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid rgba(17, 44, 60, 0.08);
    border-radius: 16px;
    background: rgba(243, 248, 249, 0.72);
}

.user-name {
    font-weight: 700;
}

.user-role {
    color: var(--text-soft);
    font-size: 12px;
}

.content {
    min-width: 0;
}

.content-shell {
    max-width: 1600px;
    padding-left: 2px;
}

.page-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 28px;
    margin-bottom: 18px;
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-radius: 28px;
    background:
        radial-gradient(circle at top right, rgba(200, 154, 90, 0.16), transparent 28%),
        linear-gradient(180deg, rgba(255, 252, 247, 0.88), rgba(255, 248, 240, 0.8));
    box-shadow: var(--shadow);
}

.page-title {
    margin: 0;
    font-size: clamp(30px, 3vw, 42px);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.page-subtitle {
    max-width: 720px;
    margin: 12px 0 0;
    color: var(--text-soft);
    font-size: 15px;
}

.hero-metrics {
    display: flex;
    align-items: stretch;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.result-pill {
    min-width: 156px;
    padding: 14px 16px;
    border: 1px solid rgba(17, 44, 60, 0.08);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.74);
}

.result-pill span,
.result-pill small {
    display: block;
    color: var(--text-soft);
}

.result-pill strong {
    display: block;
    margin: 8px 0 2px;
    font-size: 28px;
    line-height: 1;
}

.result-pill.subtle {
    background: rgba(241, 247, 247, 0.76);
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
    margin-bottom: 16px;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: 24px;
    background: linear-gradient(180deg, var(--paper), rgba(255, 254, 250, 0.84));
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    overflow-x: auto;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.toolbar .page-title {
    margin-right: auto;
    font-size: clamp(26px, 2.4vw, 36px);
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.section-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.section-desc {
    margin: 6px 0 0;
    color: var(--text-soft);
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn,
button {
    appearance: none;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    padding: 10px 16px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: 0 8px 18px rgba(13, 33, 48, 0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.btn:hover,
button:hover {
    transform: translateY(-1px);
    border-color: rgba(29, 118, 103, 0.28);
    box-shadow: 0 12px 22px rgba(13, 33, 48, 0.08);
}

.btn.primary,
button.primary {
    border-color: rgba(18, 79, 88, 0.42);
    background: linear-gradient(135deg, var(--accent) 0%, #2b8576 100%);
    color: #fff;
}

.btn.warn,
button.warn {
    border-color: rgba(200, 154, 90, 0.42);
    background: linear-gradient(135deg, #d8a45e 0%, #be8850 100%);
    color: #fff;
}

.btn.danger,
button.danger {
    border-color: rgba(178, 81, 73, 0.42);
    background: linear-gradient(135deg, var(--danger) 0%, #923f37 100%);
    color: #fff;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(24, 49, 65, 0.12);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--text);
    font: inherit;
    box-shadow: inset 0 1px 2px rgba(15, 23, 31, 0.03);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(29, 118, 103, 0.48);
    box-shadow: 0 0 0 4px rgba(29, 118, 103, 0.12);
    background: #fff;
}

input[type="checkbox"] {
    width: auto;
    padding: 0;
    box-shadow: none;
    accent-color: var(--accent);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #284454;
    font-weight: 700;
}

.field {
    margin-bottom: 16px;
}

.muted {
    color: var(--text-soft);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.filters > div {
    flex: 1 1 160px;
    min-width: 150px;
}

.filters-panel {
    padding-top: 24px;
}

.filter-actions {
    align-self: end;
}

.filters .actions {
    flex: 0 0 auto;
    min-width: auto;
    margin-left: auto;
}

.stat strong {
    display: block;
    margin-top: 10px;
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.table-shell {
    overflow-x: auto;
    margin: 0 -4px;
    padding: 0 4px;
}

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

thead th {
    padding: 14px 12px;
    color: var(--text-soft);
    font-weight: 700;
    text-align: left;
    background: rgba(20, 55, 73, 0.06);
    border-bottom: 1px solid rgba(17, 44, 60, 0.08);
}

thead th:first-child {
    border-top-left-radius: 16px;
}

thead th:last-child {
    border-top-right-radius: 16px;
}

tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(17, 44, 60, 0.08);
    vertical-align: top;
}

tbody tr {
    background: rgba(255, 255, 255, 0.48);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.8);
}

tfoot th,
tfoot td {
    padding: 14px 12px;
    text-align: left;
    border-top: 1px solid rgba(17, 44, 60, 0.08);
    background: rgba(20, 55, 73, 0.04);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(29, 118, 103, 0.12);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge.gray {
    background: rgba(102, 120, 135, 0.14);
    color: #526371;
}

.badge.red {
    background: rgba(178, 81, 73, 0.14);
    color: #973b34;
}

.flash {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 18px;
}

.flash.success {
    border: 1px solid rgba(29, 118, 103, 0.18);
    background: rgba(232, 246, 239, 0.82);
}

.flash.error {
    border: 1px solid rgba(178, 81, 73, 0.18);
    background: rgba(255, 241, 239, 0.86);
}

.pagination {
    margin-top: 18px;
}

.pagination nav {
    display: flex;
    justify-content: flex-end;
}

.pagination nav > div:first-child {
    display: none;
}

.pagination nav > div:last-child {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination nav > div:last-child span,
.pagination nav > div:last-child a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(17, 44, 60, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
}

.inline-form {
    display: inline-flex;
}

pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 16px;
    border: 1px solid rgba(17, 44, 60, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.66);
}

body.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.install-layout {
    position: relative;
    z-index: 1;
    width: min(1200px, 100%);
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 24px;
    align-items: stretch;
}

.install-sidebar,
.install-panel {
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 30px;
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.82), rgba(255, 248, 240, 0.84));
    box-shadow: var(--shadow);
}

.install-sidebar {
    padding: 28px;
}

.install-sidebar h1 {
    margin: 10px 0 12px;
    font-size: clamp(32px, 3.5vw, 44px);
    line-height: 1.08;
    letter-spacing: -0.04em;
}

.install-sidebar p {
    margin: 0;
    color: var(--text-soft);
}

.install-steps {
    margin: 24px 0 0;
    padding-left: 18px;
    color: var(--text-soft);
}

.install-steps li + li {
    margin-top: 10px;
}

.install-steps li.active {
    color: var(--text);
    font-weight: 700;
}

.install-main {
    min-width: 0;
}

.install-panel {
    padding: 28px;
}

.install-progress {
    margin: 18px 0;
}

.install-progress-bar {
    width: 100%;
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(20, 55, 73, 0.08);
}

.install-progress-value {
    width: 0;
    height: 100%;
    background: linear-gradient(135deg, var(--accent) 0%, #2b8576 100%);
    transition: width 0.25s ease;
}

.install-progress-text {
    margin-top: 8px;
    color: var(--text-soft);
    font-weight: 700;
}

.install-step-list {
    display: grid;
    gap: 12px;
}

.install-step {
    padding: 14px 16px;
    border: 1px solid rgba(17, 44, 60, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
}

.install-step strong,
.install-step span {
    display: block;
}

.install-step span {
    margin-top: 6px;
    color: var(--text-soft);
}

.install-step.success {
    border-color: rgba(29, 118, 103, 0.18);
    background: rgba(232, 246, 239, 0.72);
}

.install-step.error {
    border-color: rgba(178, 81, 73, 0.18);
    background: rgba(255, 241, 239, 0.8);
}

.btn.disabled,
.btn[aria-disabled="true"] {
    pointer-events: none;
    opacity: 0.48;
}

.auth-layout {
    position: relative;
    z-index: 1;
    width: min(1200px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 460px);
    gap: 24px;
    align-items: stretch;
}

.auth-intro,
.login-card {
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 30px;
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.82), rgba(255, 248, 240, 0.84));
    box-shadow: var(--shadow);
}

.auth-intro {
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.auth-brand .brand-mark {
    width: 72px;
    height: 72px;
}

.auth-copy h1 {
    margin: 10px 0 14px;
    font-size: clamp(36px, 4vw, 52px);
    line-height: 1.02;
    letter-spacing: -0.05em;
}

.auth-copy p {
    max-width: 560px;
    margin: 0;
    color: var(--text-soft);
    font-size: 16px;
}

.auth-feature-list {
    display: grid;
    gap: 12px;
}

.auth-feature {
    padding: 16px 18px;
    border: 1px solid rgba(17, 44, 60, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.64);
}

.auth-feature strong,
.auth-feature span {
    display: block;
}

.auth-feature span {
    margin-top: 6px;
    color: var(--text-soft);
}

.login-card {
    padding: 28px;
}

.login-card h2 {
    margin: 8px 0 6px;
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.login-card-header {
    margin-bottom: 18px;
}

.error-list {
    margin-bottom: 16px;
}

.check-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    font-weight: 600;
}

.login-submit {
    width: 100%;
    justify-content: center;
    padding: 13px 18px;
}

.hint {
    margin-top: 14px;
    color: var(--text-soft);
    font-size: 13px;
}

@media (max-width: 1160px) {
    .app {
        display: block;
    }

    .sidebar {
        position: relative;
        width: 100%;
        min-height: auto;
        bottom: auto;
        padding: 0;
    }

    .sidebar-brand {
        padding-bottom: 10px;
    }

    .sidebar-scroll {
        overflow: visible;
        padding: 8px var(--sidebar-padding-x) 22px;
    }

    .main {
        margin-left: 0;
        padding: 16px;
    }

    .topbar {
        position: relative;
        left: auto;
        right: auto;
        padding: 0;
    }

    .content {
        padding-top: 22px;
    }

    .topbar-card,
    .page-hero,
    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero-metrics {
        justify-content: flex-start;
    }

    .auth-layout {
        grid-template-columns: 1fr;
    }

    .install-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    body {
        font-size: 13px;
    }

    .main {
        padding: 16px;
    }

    .grid-4,
    .grid-3,
    .grid-2,
    .filters {
        grid-template-columns: 1fr !important;
    }

    .topbar-actions,
    .toolbar,
    .actions,
    .hero-metrics {
        width: 100%;
    }

    .topbar-actions > *,
    .toolbar > *,
    .actions > * {
        width: 100%;
    }

    .actions .inline-form,
    .actions form,
    .actions .btn,
    .actions button {
        width: 100%;
    }

    .result-pill {
        width: 100%;
    }
}
