:root {
    color-scheme: light;
    --ink: #202a2b;
    --muted: #667273;
    --line: #d9dfdc;
    --paper: #ffffff;
    --canvas: #f3f5f2;
    --green: #176b53;
    --green-dark: #10543f;
    --red: #a33832;
    --red-bg: #fff0ee;
    font-family: "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

.list-filter, .pagination { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.list-filter input { flex: 1 1 200px; }
.list-filter select { padding: 10px; border: 1px solid var(--line); background: white; border-radius: 4px; }
.pagination input[type=number] { width: 90px; }
.cancel-button { padding: 0 12px; color: var(--green); background: #e5eee9; white-space: nowrap; }
.voice-area { text-align: center; margin: 24px 0; }
.voice-area .image-mic { display: inline-flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 32px; background: white; border: 2px solid #c7dfd5; border-radius: 18px; font-size: 16px; }
.image-mic img { width: 90px; height: 150px; object-fit: contain; }
.voice-area .image-mic.listening { background: #ffe7e1; border-color: #c65343; color: #7c2119; }
.voice-area p { margin: 12px 0; }
button:disabled { opacity: .5; cursor: not-allowed; }
.count-form .primary { white-space: nowrap; }
.recent-panel td:nth-child(2) { white-space: normal; min-width: 140px; }
.recent-panel th:last-child, .recent-panel td:last-child { position: sticky; right: 0; background: white; box-shadow: -2px 0 3px #e8ece9; }
@media(max-width:640px) { .topbar { flex-wrap: wrap; gap: 10px; padding-top: 12px!important; padding-bottom: 12px!important; } .topbar nav { flex-wrap: wrap; } .count-form .input-row { flex-wrap: wrap; } .count-form .input-row input { flex-basis: 100%; } .count-form .input-row .primary, .count-form .cancel-button { flex: 1; } }

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 15px; }
a { color: inherit; }
.topbar { min-height: 58px; padding: 0 max(20px, calc((100% - 1120px) / 2)); display: flex; align-items: center; justify-content: space-between; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { color: var(--green); font-weight: 750; text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 20px; color: var(--muted); font-size: 14px; }
.topbar nav a { text-decoration: none; }
.container { width: min(1120px, calc(100% - 32px)); margin: 28px auto 64px; }
.page-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 26px; }
h2 { margin-bottom: 14px; font-size: 18px; }
.eyebrow { margin-bottom: 7px; color: var(--green); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.muted, .saved-by { color: var(--muted); font-size: 13px; line-height: 1.6; }
.panel, .login-panel, .item-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 20px; }
.login-panel { width: min(420px, 100%); margin: 60px auto; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 7px; font-size: 14px; font-weight: 650; }
input { min-width: 0; width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ink); background: #fff; border: 1px solid #bec9c4; border-radius: 4px; font: inherit; }
input:focus { outline: 2px solid #86b9a8; outline-offset: 1px; border-color: var(--green); }
button, .button-link { min-height: 42px; border: 0; border-radius: 4px; font: inherit; font-weight: 650; cursor: pointer; }
.primary { padding: 0 18px; color: #fff; background: var(--green); }
.primary:hover { background: var(--green-dark); }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.link-button { min-height: 0; padding: 4px 0; color: var(--green); background: transparent; }
.inline { display: inline; }
.notice { margin: 0 0 18px; padding: 12px 14px; border: 1px solid #b8d8cb; border-radius: 4px; background: #eaf5ef; color: #185a43; line-height: 1.5; }
.notice.error { color: var(--red); background: var(--red-bg); border-color: #efc4bd; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 22px 0; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.stats div { padding: 16px 20px; display: grid; gap: 7px; border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats span, .facts span, .label { color: var(--muted); font-size: 13px; }
.stats strong { font-size: 24px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.table-panel { margin-top: 16px; padding-bottom: 6px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 14px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e8ece9; text-align: left; }
th { color: var(--muted); font-size: 12px; font-weight: 700; }
.small-button { min-height: 30px; padding: 0 10px; color: var(--green); background: #e9f3ef; font-size: 13px; }
.empty { color: var(--muted); text-align: center; }
.work-area { width: min(720px, 100%); margin: 14px auto; }
.search-form { margin-top: 24px; }
.search-form > label, .count-form > label { margin-bottom: 8px; }
.input-row { display: flex; align-items: stretch; gap: 8px; }
.input-row input { flex: 1; }
.mic-button { flex: 0 0 48px; color: var(--green); background: #e5f0eb; font-size: 20px; }
.mic-button.listening { color: #fff; background: #b34b42; }
.mic-button:disabled { opacity: .75; cursor: wait; }
.item-panel { margin-top: 20px; padding: 22px; }
.item-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.item-title > div { display: grid; gap: 5px; }
.code { font-size: 20px; }
.location { padding: 6px 10px; color: var(--green-dark); background: #e8f2ed; border-radius: 3px; font-size: 13px; }
.item-panel h2 { margin: 18px 0; font-size: 20px; line-height: 1.5; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts div { display: grid; gap: 6px; }
.count-form { display: grid; gap: 9px; margin-top: 18px; }
.count-form > label:not(:first-of-type) { margin-top: 8px; }
.saved-by { margin: 14px 0 0; }

@media (max-width: 640px) {
    .topbar { min-height: 54px; padding: 0 16px; }
    .topbar nav { gap: 12px; font-size: 13px; }
    .container { width: min(100% - 24px, 600px); margin-top: 20px; }
    h1 { font-size: 23px; }
    .admin-grid { grid-template-columns: 1fr; }
    .stats div { padding: 13px 10px; }
    .stats span { font-size: 12px; }
    .stats strong { font-size: 20px; }
    .panel, .item-panel { padding: 16px; }
    .input-row { gap: 6px; }
    .input-row .primary { padding: 0 12px; }
    .mic-button { flex-basis: 44px; }
    .item-title { align-items: flex-start; }
}

/* 按住话筒避免触发滚动、长按菜单和图片拖拽。 */
.image-mic, .image-mic * {touch-action:none; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none;}
.image-mic img {pointer-events:none; -webkit-user-drag:none;}
.recent-panel table {table-layout:fixed; white-space:normal; font-size:12px;}
.recent-panel th, .recent-panel td {padding:8px 4px; overflow-wrap:anywhere;}
.recent-panel th:first-child {width:40%;}
.recent-panel th:nth-child(2), .recent-panel th:nth-child(3) {width:16%;}
.recent-panel th:last-child {width:28%;}
.recent-panel td:nth-child(2) {min-width:0;}
.recent-panel .small-button {padding:4px 6px; font-size:12px;}
.container.history-wide {width:calc(100% - 32px);max-width:1800px;}
.history-edit-wrap {overflow:visible;}
.history-edit-table {table-layout:fixed;white-space:normal;}
.history-edit-table th,.history-edit-table td {padding:10px 6px;overflow-wrap:anywhere;}
.history-edit-table th:nth-child(1) {width:5%;}
.history-edit-table th:nth-child(2) {width:14%;}
.history-edit-table th:nth-child(3) {width:10%;}
.history-edit-table th:nth-child(4) {width:12%;}
.history-edit-table th:nth-child(5) {width:25%;}
.history-edit-table th:nth-child(6),.history-edit-table th:nth-child(7) {width:9%;}
.history-edit-table th:nth-child(8) {width:9%;}
.history-edit-table th:nth-child(9) {width:7%;}
.history-edit-table input,.history-edit-table select {width:100%;min-width:0;max-width:100%;padding:8px 6px;font:inherit;}
.history-edit-table select {min-height:42px;}
.history-edit-table .small-button {width:100%;padding:4px;}
@media(max-width:1000px) {
 .history-edit-table thead {display:none;}
 .history-edit-table,.history-edit-table tbody {display:block;width:100%;}
 .history-edit-table tr {display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0;padding:12px;border:1px solid var(--line);border-radius:6px;}
 .history-edit-table td {display:block;min-width:0;border:0;padding:0;}
 .history-edit-table td::before {content:attr(data-label);display:block;color:var(--muted);font-size:12px;margin-bottom:5px;}
 .history-edit-table td:nth-child(5) {grid-column:1/-1;}
 .history-edit-table td:last-child {grid-column:1/-1;}
 .history-edit-table td:last-child button {min-height:44px;}
}

/* 长条语音按钮，与输入区域同宽；保留按住说话的触控行为。 */
.voice-area .image-mic.voice-bar {
    display:flex;width:100%;min-height:52px;height:52px;padding:0 16px;
    justify-content:center;align-items:center;border:0;border-radius:4px;
    background:var(--green);color:white;font-size:17px;font-weight:650;
}
.voice-area .voice-bar:hover {background:var(--green-dark);}
.voice-area .voice-bar.listening {background:#b34b42;color:white;}
.voice-area .voice-bar:focus-visible {outline:3px solid #86b9a8;outline-offset:3px;}
