:root {
    --bg: #eef5ff;
    --card: #ffffff;
    --ink: #1c2434;
    --muted: #667085;
    --line: #dbe7f5;
    --sidebar: #1d4ed8;
    --sidebar-ink: #e7f0ff;
    --accent: #2563eb;
    --accent-dark: #1e40af;
    --danger: #c2410c;
    --ok: #047857;
    --shadow: 0 10px 30px rgba(18, 38, 63, 0.06);
    --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    background: var(--sidebar);
    color: var(--sidebar-ink);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.brand {
    padding: 22px 20px 16px;
    font-size: 15px;
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #fff;
}

.nav { display: flex; flex-direction: column; padding: 8px 12px 12px; gap: 4px; flex: 1; }

.nav a,
.sidebar-foot a,
.sidebar-foot button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    color: var(--sidebar-ink);
    text-decoration: none;
    text-align: left;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
}

.nav a:hover,
.sidebar-foot a:hover,
.sidebar-foot button:hover { background: rgba(255, 255, 255, 0.12); }

.nav a.active,
.sidebar-foot a.active {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.nav svg,
.sidebar-foot svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.sidebar-foot form { margin: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
}

.topbar-main { display: flex; align-items: center; gap: 10px; min-width: 0; }

.topbar h1 { margin: 0; font-size: 18px; font-weight: 650; }

.nav-toggle,
.nav-backdrop { display: none; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; color: var(--muted); flex-wrap: wrap; }
.disk-free { color: var(--accent); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.system-time { color: var(--ink); font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.system-clock {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 0 16px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
}
.system-clock span { color: var(--muted); }
.system-clock strong { font-size: 28px; font-weight: 650; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }

.who { color: var(--ink); }

.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }

.lang-switch a {
    padding: 4px 10px;
    color: var(--muted);
    text-decoration: none;
}

.lang-switch a.active { background: var(--sidebar); color: #fff; }

.content { padding: 24px; }

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 18px 8px;
}

.content .card + .card { margin-top: 16px; }

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.toolbar-start { justify-content: flex-start; align-items: center; }

.list-bar { display: flex; justify-content: flex-start; margin: 0 0 12px; }

.list-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin: 0 0 14px; }
.list-meta .hint { margin: 0; }

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

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.field label { color: var(--muted); font-size: 13px; }

.filters input.wide { min-width: 260px; }

.field input, .field select, .field input[type="file"] {
    height: 38px;
    border: 1px solid #d5dbe6;
    border-radius: 10px;
    padding: 0 12px;
    background: #fff;
    color: var(--ink);
    min-width: 180px;
}

.field textarea {
    width: 100%;
    min-height: 96px;
    border: 1px solid #d5dbe6;
    border-radius: 10px;
    padding: 10px 12px;
    resize: vertical;
    background: #fff;
    color: var(--ink);
}

input.date-picker-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='1.8'%3E%3Crect x='4' y='5' width='16' height='15' rx='2'/%3E%3Cpath d='M8 3v4M16 3v4M4 10h16'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
    padding-right: 34px;
}
.date-popover {
    position: fixed;
    inset: auto;
    z-index: 30;
    width: 280px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 18px 40px rgba(18, 38, 63, 0.18);
}
dialog .date-popover { z-index: 5; }
.date-popover-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.date-popover-head strong { font-size: 14px; }
.date-popover-nav,
.date-grid button,
.date-popover-actions button {
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}
.date-popover-nav {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #eef5ff;
    color: var(--accent);
    font-size: 18px;
    line-height: 1;
}
.date-week,
.date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-week span { text-align: center; color: var(--muted); font-size: 12px; }
.date-grid button { height: 32px; border-radius: 8px; }
.date-grid button:hover { background: #eef5ff; }
.date-grid button.is-muted { color: #98a2b3; }
.date-grid button.is-today { box-shadow: inset 0 0 0 1px var(--accent); }
.date-grid button.is-selected,
.date-grid button.is-selected:hover { background: var(--accent); color: #fff; }
.date-popover-time { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.date-popover-time input {
    width: 64px;
    height: 32px;
    border: 1px solid #d5dbe6;
    border-radius: 8px;
    padding: 0 8px;
    background: #fff;
}
.date-popover-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; }
.date-popover-actions button {
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    background: #eef5ff;
    color: var(--accent);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid rgba(37, 99, 235, 0.25);
    border-color: var(--accent);
}

.picker { position: relative; min-width: 240px; }
.picker-input { width: 100%; }
.picker-list {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: #fff;
    border: 1px solid #d5dbe6;
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-height: 240px;
    overflow: auto;
}
.picker-list button {
    width: 100%;
    height: auto;
    min-height: 36px;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    color: var(--ink);
}
.picker-list button:hover,
.picker-list button.active { background: #eef2ff; }
.picker-empty { padding: 8px 10px; color: var(--muted); }

.form-card { max-width: 760px; padding-bottom: 18px; }
.form-card.wide { max-width: none; }
.form-card.wide > .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.form-card.wide > .form-grid .span-2 { grid-column: 1 / -1; }

@media (max-width: 1200px) {
    .form-card.wide > .form-grid { grid-template-columns: 1fr 1fr; }
}

.field input[readonly] { background: #f4f6fa; color: var(--muted); }
.field input[type="file"] { height: auto; min-height: 38px; padding: 8px 12px; }
.file-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.file-list a { word-break: break-all; }
.attachment-card { padding: 8px 12px 6px; }
.attachment-card .section-head { margin-bottom: 2px; }
.attachment-files {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    gap: 6px 14px;
    margin: 0;
}
.attachment-files li { width: auto; flex: 0 1 auto; justify-content: flex-start; gap: 4px; min-width: 0; }
.attachment-files a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; }
.attachment-files .btn { height: 26px; padding: 0 8px; font-size: 12px; flex: none; }
.upload-picker { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: min(100%, 420px); }
.upload-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
}
.upload-drop.is-dragover { border-color: var(--accent); background: #eef2ff; }
.upload-drop.is-disabled { opacity: 0.45; }
.upload-drop .hint { margin: 0; }
.field .upload-file {
    position: absolute;
    width: 1px;
    height: 1px;
    min-width: 0;
    min-height: 0;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}
.upload-drop:focus-within { outline: 2px solid rgba(37, 99, 235, 0.25); border-color: var(--accent); }
.upload-chosen {
    list-style: none;
    width: min(100%, 420px);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.upload-chosen:empty { display: none; }
.upload-chosen li {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 4px 4px 4px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}
.upload-chosen-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-chosen .btn { height: 28px; padding: 0 10px; font-size: 12px; white-space: nowrap; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.span-2 { grid-column: span 2; }

.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    background: #fff;
    color: var(--ink);
}

.btn:hover { text-decoration: none; }

.btn-primary,
button.btn.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover,
button.btn.btn-primary:hover { background: var(--accent-dark); }

.btn-soft,
button.btn.btn-soft { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.btn-soft:hover,
button.btn.btn-soft:hover { background: #bfdbfe; color: #1e40af; }
.btn:disabled,
.btn-soft:disabled,
button.btn.btn-soft:disabled {
    background: #e5e7eb;
    color: #98a2b3;
    border-color: #e5e7eb;
    cursor: not-allowed;
}
.btn:disabled:hover,
.btn-soft:disabled:hover,
button.btn.btn-soft:disabled:hover {
    background: #e5e7eb;
    color: #98a2b3;
}

.btn-ghost { border-color: #d5dbe6; background: #fff; color: var(--ink); }

.btn-danger,
button.btn.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover,
button.btn.btn-danger:hover { background: #b91c1c; color: #fff; border-color: #b91c1c; }

.btn-success,
button.btn.btn-success { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover,
button.btn.btn-success:hover { background: #15803d; color: #fff; border-color: #15803d; }

.btn-edit,
a.btn.btn-edit,
button.btn.btn-edit { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-edit:hover,
a.btn.btn-edit:hover,
button.btn.btn-edit:hover { background: var(--accent-dark); color: #fff; border-color: var(--accent-dark); }

.btn-warning,
button.btn.btn-warning { background: #ea580c; color: #fff; border-color: #ea580c; }
.btn-warning:hover,
button.btn.btn-warning:hover { background: #c2410c; color: #fff; border-color: #c2410c; }

.inline { display: inline; }

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

table { width: 100%; border-collapse: collapse; }

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

table.dense th, table.dense td { white-space: nowrap; }

th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: 0.03em; }

tr:last-child td { border-bottom: 0; }

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

td.actions {
    display: table-cell;
    vertical-align: middle;
    white-space: nowrap;
}

td.actions > a,
td.actions > form,
td.actions > .btn {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

td.actions > * + * { margin-left: 8px; }

.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.alert.success { background: #ecfdf5; color: var(--ok); }
.alert.error { background: #fff7ed; color: var(--danger); }
.alert ul { margin: 0; padding-left: 18px; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }

.tabs a {
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    text-decoration: none;
    border: 1px solid var(--line);
}

.tabs a.active { background: var(--sidebar); color: #fff; border-color: var(--sidebar); }

.badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    margin: 2px 6px 2px 0;
    padding: 0 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    vertical-align: middle;
}

.badge.off { background: #f3f4f6; color: #6b7280; }

.hint { color: var(--muted); margin: 0 0 14px; }

.template-box {
    margin: 8px 0 12px;
    padding: 12px 14px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: #eff6ff;
}
.template-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.template-box p,
.template-head p { margin: 0; color: #1e3a8a; }
.template-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: row; align-items: stretch; gap: 4px; }
.template-list li {
    flex: 1;
    min-width: 0;
    display: flex;
}
.template-list a {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    word-break: break-word;
}

.empty { color: var(--muted); padding: 18px 4px 22px; }

table.detail { width: 100%; border-collapse: collapse; margin: 0 0 8px; }
table.detail th,
table.detail td {
    padding: 6px 10px;
    border: 1px solid var(--line);
    vertical-align: top;
    text-align: left;
    font-size: 14px;
    letter-spacing: 0;
}
table.detail th {
    width: 15%;
    color: var(--muted);
    background: #f8fafc;
    font-weight: 600;
    white-space: nowrap;
}
table.detail td { width: 35%; word-break: break-word; }
table.detail tr:last-child th,
table.detail tr:last-child td { border-bottom: 1px solid var(--line); }
.pre-line { white-space: pre-wrap; }

.timeline { list-style: none; margin: 8px 0 0; padding: 0 0 8px; }
.timeline > li { position: relative; padding: 0 0 8px 22px; }
.timeline > li:before {
    content: "";
    position: absolute;
    left: 4px;
    top: 6px;
    bottom: 0;
    width: 2px;
    background: #dbe3f0;
}
.timeline > li:last-child:before { display: none; }
.timeline > li:after {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
}
.timeline strong { display: block; }
.timeline span { color: var(--muted); font-size: 13px; }
.timeline .node-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.timeline .node-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timeline .node-date { color: var(--muted); font-size: 13px; }
.timeline .node-note { margin: 2px 0 0; }
.timeline .node-note-text { white-space: pre-wrap; }
.timeline .node-files-open {
    margin: 0 0 0 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    cursor: pointer;
}
.timeline .node-files-open:hover { text-decoration: underline; }
.timeline .node-files-dialog { margin: auto; }
.timeline .node-files-toolbar { margin: 0 0 8px; }
.timeline .node-files-dialog .file-list { margin: 0; }
.timeline .node-status {
    display: inline-flex;
    align-items: center;
    height: 24px;
    margin: 0;
    padding: 0 10px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}
.timeline .file-list { margin: 4px 0 0; }
.node-downloads { margin: 0 0 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.section-head .actions { flex-wrap: wrap; justify-content: flex-end; }
.section-head .section-title { margin: 0; }
.node-dialog,
.confirm-dialog {
    border: 0;
    border-radius: 14px;
    padding: 18px 18px 8px;
    color: var(--ink);
    box-shadow: 0 24px 60px rgba(18, 38, 63, 0.24);
}
.node-dialog { width: min(640px, calc(100vw - 32px)); }
.node-dialog::backdrop,
.confirm-dialog::backdrop { background: rgba(18, 38, 63, 0.45); }
.node-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.node-dialog-head h2 { margin: 0; font-size: 16px; }
.node-dialog .field textarea { min-height: 88px; }
.confirm-dialog { width: min(440px, calc(100vw - 32px)); padding-bottom: 18px; }
.confirm-dialog h2 { margin: 0 0 12px; font-size: 16px; }
.confirm-dialog p { margin: 0 0 16px; }
.confirm-dialog .confirm-ok.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.confirm-dialog .confirm-ok.btn-danger:hover { background: #b91c1c; color: #fff; border-color: #b91c1c; }
.confirm-dialog .confirm-ok.btn-success { background: #16a34a; color: #fff; border-color: #16a34a; }
.confirm-dialog .confirm-ok.btn-success:hover { background: #15803d; color: #fff; border-color: #15803d; }
.confirm-dialog .confirm-ok.btn-warning { background: #ea580c; color: #fff; border-color: #ea580c; }
.confirm-dialog .confirm-ok.btn-warning:hover { background: #c2410c; color: #fff; border-color: #c2410c; }
.field .select-dialog-open {
    display: flex;
    align-items: center;
    width: 100%;
    height: 38px;
    min-width: 0;
    padding: 0 28px 0 12px;
    border: 1px solid #d5dbe6;
    border-radius: 10px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E") no-repeat right 10px center;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}
.field .select-dialog-open.is-empty { color: var(--muted); }
.select-dialog {
    border: 0;
    border-radius: 14px;
    width: min(720px, calc(100vw - 32px));
    margin: auto;
    padding: 12px;
    color: var(--ink);
    box-shadow: 0 24px 60px rgba(18, 38, 63, 0.24);
}
.select-dialog::backdrop { background: rgba(18, 38, 63, 0.45); }
.select-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.select-dialog-head h2 { margin: 0; font-size: 15px; }
.select-dialog-head .btn { height: 30px; padding: 0 10px; }
.select-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    max-height: min(60vh, 420px);
    overflow: auto;
}
.select-option {
    min-height: 30px;
    height: auto;
    margin: 0;
    padding: 4px 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    line-height: 1.25;
    text-align: center;
    word-break: break-word;
    cursor: pointer;
}
.select-option.is-selected { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.select-option:hover { border-color: #93c5fd; }
.announcement-dialog {
    border: 0;
    border-radius: 14px;
    width: min(520px, calc(100vw - 32px));
    margin: auto;
    padding: 18px;
    color: var(--ink);
    box-shadow: 0 24px 60px rgba(18, 38, 63, 0.24);
}
.announcement-dialog::backdrop { background: rgba(18, 38, 63, 0.45); }
.announcement-dialog h2 { margin: 0 0 12px; font-size: 16px; }
.announcement-dialog article + article { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.announcement-dialog h3 { margin: 0 0 6px; font-size: 15px; }
.announcement-dialog p { margin: 0; white-space: pre-wrap; }
.announcement-dialog .actions { margin-top: 16px; justify-content: flex-end; }

.checks { display: grid; gap: 8px; }
.check {
    display: flex;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fbfcfe;
}
.check input { width: 16px; height: 16px; }

.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding: 12px 4px 14px; color: var(--muted); }
.pager-disabled { opacity: 0.45; }

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: safe center;
    justify-content: center;
    box-sizing: border-box;
    padding: 24px 16px;
    background:
        radial-gradient(900px 400px at 10% -10%, rgba(37, 99, 235, 0.28), transparent 60%),
        linear-gradient(160deg, #1e40af, #3b82f6 55%, #eef5ff 55%);
}

.login-card {
    width: min(420px, calc(100% - 32px));
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(16, 35, 61, 0.18);
    padding: 28px 28px 22px;
}

.login-card h1 { margin: 0 0 8px; font-size: 26px; line-height: 1.2; }
.login-card h1 .en,
.login-card .sub .en,
.login-card label .en { display: block; color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.3; }
.login-card h1 .en { margin-top: 4px; font-size: 15px; }
.login-card .sub { color: var(--ink); margin: 0 0 18px; font-weight: 600; }
.login-card .field { margin-bottom: 12px; }
.login-card .field label { color: var(--ink); }
.login-card .field input { width: 100%; min-width: 0; }
.remember { display: flex; align-items: flex-start; gap: 8px; margin: 2px 0 16px; color: var(--ink); }
.remember input { margin-top: 3px; }
.login-card .btn { width: 100%; height: auto; min-height: 48px; flex-direction: column; gap: 1px; line-height: 1.2; padding: 8px 14px; }
.login-card .btn .en { color: rgba(255, 255, 255, 0.82); font-size: 12px; font-weight: 500; }

.section-title { margin: 0 0 12px; font-size: 16px; }
.stat-grid + .section-title { margin-top: 22px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.stat-card {
    display: flex;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--ink);
    text-decoration: none;
    border: 1px solid transparent;
}

.stat-card {
    flex-direction: column;
    gap: 8px;
    min-height: 118px;
    padding: 16px;
}

.stat-card:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.stat-label { color: var(--muted); font-size: 13px; line-height: 1.35; }

.stat-card strong { font-size: 28px; line-height: 1; letter-spacing: -0.03em; }

.stat-go { margin-top: auto; color: var(--accent); font-size: 12px; }

.stat-card.is-off { opacity: 0.72; }

.stat-card.total { background: var(--sidebar); }

.stat-card.total .stat-label,
.stat-card.total .stat-go { color: rgba(255, 255, 255, 0.78); }

.stat-card.total strong { color: #fff; }

@media (max-width: 860px) {
    body.nav-lock { overflow: hidden; }

    .shell { display: block; }

    .nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 30;
        border: 0;
        padding: 0;
        background: rgba(18, 38, 63, 0.45);
    }

    .shell.nav-open .nav-backdrop { display: block; }

    .sidebar {
        position: fixed;
        z-index: 40;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(280px, 86vw);
        height: auto;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        overflow: auto;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .shell.nav-open .sidebar { transform: none; }

    .nav a,
    .sidebar-foot a,
    .sidebar-foot button { min-height: 48px; }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        flex-shrink: 0;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
        color: var(--ink);
        padding: 0;
        cursor: pointer;
    }

    .nav-toggle svg { width: 22px; height: 22px; }

    .main { min-height: 100vh; }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 20;
        height: auto;
        flex-wrap: wrap;
        align-items: center;
        padding: max(10px, env(safe-area-inset-top)) 12px 10px;
        gap: 8px;
    }

    .topbar-main { flex: 1 1 auto; }

    .topbar h1 {
        font-size: 17px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .top-actions {
        flex: 1 1 100%;
        justify-content: flex-start;
        gap: 8px;
    }

    .top-actions .btn { min-height: 40px; }

    .lang-switch a {
        display: inline-flex;
        align-items: center;
        min-height: 36px;
        padding: 0 12px;
    }

    .who { font-size: 13px; min-width: 0; }

    .content {
        padding: 12px 12px max(16px, env(safe-area-inset-bottom));
    }

    .card { padding: 12px 12px 4px; }

    .toolbar,
    .section-head,
    .timeline .node-head {
        flex-direction: column;
        align-items: stretch;
    }

    .timeline .actions {
        width: 100%;
        white-space: normal;
    }

    .timeline .actions a,
    .timeline .actions .btn,
    .timeline .actions form {
        flex: 1 1 calc(50% - 8px);
    }

    .timeline .actions form { display: flex; }

    .timeline .actions a,
    .timeline .actions .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 42px;
        padding: 0 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
    }

    .timeline .actions .btn { width: 100%; }
    .timeline .actions .btn-edit,
    .timeline .actions button.btn.btn-edit { color: #fff; border-color: var(--accent); background: var(--accent); }

    .template-head,
    .template-list { flex-direction: column; align-items: stretch; }

    .filters { width: 100%; }

    .filters .field,
    .toolbar > a.btn,
    .toolbar > .btn,
    .toolbar > form,
    .section-head .actions { width: 100%; flex-direction: column; }
    .section-head .btn { width: 100%; }
    .attachment-card .section-head { flex-direction: row; align-items: center; }
    .attachment-card .section-head .btn { width: auto; }

    .filters .field > label:not([for]) { display: none; }

    .filters .btn,
    .toolbar > form .btn { width: 100%; min-height: 44px; }

    .field { margin-bottom: 12px; }

    .field input,
    .field select,
    .field textarea,
    .login-card .field input {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        font-size: 16px;
    }

    .field input:not([type="file"]),
    .field select,
    .field .select-dialog-open { height: 44px; }
    .select-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .picker { min-width: 0; width: 100%; }

    .form-grid,
    .form-card.wide > .form-grid { grid-template-columns: 1fr; }

    table.detail,
    table.detail tbody,
    table.detail tr { display: block; width: 100%; }
    table.detail tr { display: grid; grid-template-columns: minmax(7.5em, 38%) 1fr; }
    table.detail th,
    table.detail td { display: block; width: auto; white-space: normal; }
    table.detail td[colspan] { grid-column: 2; }

    .span-2 { grid-column: auto; }

    .form-card,
    .form-card.wide { max-width: none; }

    .form-card > .actions,
    .node-dialog .actions,
    .confirm-dialog .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-card > .actions .btn,
    .node-dialog .actions .btn,
    .confirm-dialog .actions .btn { width: 100%; min-height: 44px; height: auto; }

    .tabs { overflow-x: auto; flex-wrap: nowrap; }

    .tabs a {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        min-height: 40px;
    }

    .table-wrap { overflow: visible; }

    .table-wrap table,
    .table-wrap tbody,
    .table-wrap tr { display: block; width: 100%; }

    .table-wrap thead { display: none; }

    .table-wrap tbody tr {
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 4px 12px;
        margin-bottom: 12px;
        background: #f8fbff;
    }

    .table-wrap tbody td,
    table.dense th,
    table.dense td {
        white-space: normal;
    }

    .table-wrap tbody td {
        display: block;
        width: auto;
        border: 0;
        border-bottom: 1px solid var(--line);
        padding: 10px 0;
        text-align: left;
        overflow-wrap: anywhere;
    }

    .table-wrap tbody tr td:last-child { border-bottom: 0; }

    .table-wrap tbody td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 2px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.02em;
    }

    .table-wrap tbody td.actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        white-space: normal;
    }

    .table-wrap tbody td.actions > * + * { margin-left: 0; }

    .table-wrap tbody td.actions::before { flex: 1 0 100%; }

    .table-wrap tbody td.actions a,
    .table-wrap tbody td.actions .btn,
    .table-wrap tbody td.actions form {
        flex: 1 1 calc(50% - 8px);
        width: auto;
        min-width: 0;
    }

    .table-wrap tbody td.actions form { display: flex; }

    .table-wrap tbody td.actions a,
    .table-wrap tbody td.actions .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 42px;
        padding: 0 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
    }

    .table-wrap tbody td.actions .btn { width: 100%; }
    .table-wrap tbody td.actions .btn-danger { color: #fff; border-color: #dc2626; background: #dc2626; }
    .table-wrap tbody td.actions .btn-success { color: #fff; border-color: #16a34a; background: #16a34a; }
    .table-wrap tbody td.actions .btn-warning { color: #fff; border-color: #ea580c; background: #ea580c; }
    .table-wrap tbody td.actions a.btn-edit { color: #fff; border-color: #60a5fa; background: #60a5fa; }

    .table-wrap tbody td .badge { margin: 0 6px 6px 0; }

    .pager { justify-content: space-between; }

    .pager a,
    .pager .pager-disabled {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 88px;
        min-height: 44px;
        padding: 0 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
    }

    .node-dialog,
    .confirm-dialog {
        width: calc(100vw - 24px);
        max-height: calc(100dvh - 24px);
        overflow: auto;
    }

    .login-body { padding: 16px 12px; }

    .login-card {
        width: 100%;
        padding: 22px 16px 16px;
    }

    .login-card h1 { font-size: 22px; }

    .stat-grid { grid-template-columns: 1fr; }
}
