:root {
    color-scheme: light;
    --ink: #18201d;
    --muted: #68716d;
    --line: #dce2df;
    --paper: #ffffff;
    --canvas: #f3f5f4;
    --brand: #147d64;
    --brand-dark: #0d5c49;
    --accent: #d86b3f;
    --danger: #b33b45;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: 0;
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea { font: inherit; }

.site-header {
    height: 64px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}
.site-header__inner {
    width: min(1120px, calc(100% - 32px));
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.brand { color: var(--ink); font-size: 21px; font-weight: 750; }
.header-links { display: flex; align-items: center; gap: 18px; }
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: #cfe4dc;
}

.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 32px auto;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 28px;
}
.side-nav { border-right: 1px solid var(--line); padding-right: 22px; }
.side-nav a {
    display: block;
    padding: 10px 12px;
    margin-bottom: 4px;
    color: var(--ink);
    border-radius: 6px;
}
.side-nav a:hover, .side-nav a[aria-current="page"] {
    background: #e4efeb;
    color: var(--brand-dark);
    text-decoration: none;
}
.content { min-width: 0; }
.page-title {
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
    font-size: 26px;
    line-height: 1.25;
}
.profile-summary { display: flex; align-items: center; gap: 18px; margin-bottom: 30px; }
.profile-summary .avatar { width: 84px; height: 84px; }
.profile-summary h2 { margin: 0 0 4px; font-size: 22px; }
.profile-summary p { margin: 0; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); }
.metric { min-width: 0; padding: 18px; border-right: 1px solid var(--line); background: var(--paper); }
.metric:last-child { border-right: 0; }
.metric__label { color: var(--muted); font-size: 13px; }
.metric__value { margin-top: 5px; font-size: 21px; font-weight: 700; overflow-wrap: anywhere; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.field { min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 7px; font-weight: 650; }
.field input, .field textarea {
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    border: 1px solid #bfc8c4;
    border-radius: 5px;
    background: var(--paper);
    color: var(--ink);
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 3px solid #bde2d6; border-color: var(--brand); }
.field input:disabled { background: #edf0ef; color: var(--muted); }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }
.button {
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    background: var(--brand);
    color: white;
    font-weight: 700;
}
.button:hover { background: var(--brand-dark); }
.button--secondary { background: white; color: var(--ink); border-color: #bfc8c4; }
.button--danger { background: var(--danger); }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: #e9eeeb; }
.auth-panel { width: min(440px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.auth-panel h1 { margin: 0 0 22px; font-size: 28px; }
.auth-panel .field { margin-bottom: 16px; }
.auth-panel .button { width: 100%; }
.auth-links { margin-top: 18px; display: flex; justify-content: space-between; gap: 16px; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 4px 0 18px; }
.check-row input { width: 18px; height: 18px; }
.notice { display: none; margin: 0 0 18px; padding: 10px 12px; border-left: 4px solid var(--accent); background: #fff2e9; }
.notice.is-visible { display: block; }
.notice.is-error { border-color: var(--danger); background: #fbeaec; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--paper); }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: #edf2f0; font-size: 13px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.file-input { max-width: 100%; }
.empty { padding: 28px; color: var(--muted); text-align: center; }

.home-cover {
    width: 100vw;
    height: 100vh;
    min-height: 100dvh;
    background: #000 url('/frontend/index.jpg') center / cover no-repeat;
}

@media (max-width: 760px) {
    .page-shell { grid-template-columns: 1fr; margin-top: 20px; }
    .side-nav { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 12px; display: flex; gap: 5px; overflow-x: auto; }
    .side-nav a { white-space: nowrap; margin: 0; }
    .metrics { grid-template-columns: 1fr; }
    .metric { border-right: 0; border-bottom: 1px solid var(--line); }
    .metric:last-child { border-bottom: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .field--wide { grid-column: auto; }
    .header-links a:not(:last-child) { display: none; }
    .home-cover { background-image: url('/frontend/index-m.jpg'), url('/frontend/index.jpg'); }
}
