:root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #b45309;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

.topbar {
    background: #111827;
    color: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar .brand { font-size: 16px; font-weight: 600; letter-spacing: .5px; }
.topbar .right { display: flex; align-items: center; gap: 12px; color: #d1d5db; }
.topbar form { margin: 0; }
.topbar button { background: transparent; color: #d1d5db; border: 1px solid #4b5563; }
.topbar button:hover { color: #fff; border-color: #9ca3af; background: transparent; }

.container { max-width: 880px; margin: 32px auto; padding: 0 16px; }
.container.wide { max-width: 1200px; }

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.panel h2 { margin: 0 0 4px; font-size: 18px; }
.panel .sub { margin: 0 0 20px; color: var(--muted); }
.panel h3 { margin: 24px 0 12px; font-size: 15px; padding-top: 16px; border-top: 1px dashed var(--border); }
.panel h3:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
    padding: 10px 16px;
    cursor: pointer;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--muted);
    font-size: 14px;
    border-radius: 0;
}
.tab:hover { color: var(--text); background: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab .count {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    margin-left: 4px;
    border-radius: 10px;
    background: #e5e7eb;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}
.tab.active .count { background: #dbeafe; color: var(--primary); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.field label { display: block; margin-bottom: 6px; font-weight: 500; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

input[type=text], input[type=number], input[type=password], input[type=datetime-local], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font: inherit;
    background: #fff;
    color: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
textarea { resize: vertical; min-height: 72px; }
textarea.code { font-family: Consolas, Menlo, monospace; font-size: 12px; min-height: 120px; }

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
button:hover, .btn:hover { background: #f9fafb; text-decoration: none; }
button:disabled { opacity: .6; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--primary-hover); }
button.danger { color: var(--danger); border-color: #fca5a5; }
button.danger:hover { background: var(--danger-bg); }
button.small, .btn.small { padding: 4px 10px; font-size: 13px; }
button.link { border: 0; background: none; color: var(--primary); padding: 0 4px; }

.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.inline-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.success { background: var(--success-bg); color: var(--success); }
.alert.info { background: #eff6ff; color: #1e40af; }
.hidden { display: none !important; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.badge.PENDING { background: var(--warning-bg); color: var(--warning); }
.badge.APPROVED { background: var(--success-bg); color: var(--success); }
.badge.REJECTED { background: var(--danger-bg); color: var(--danger); }
.badge.source { background: #f3f4f6; color: var(--muted); }

.hw { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; }
.hw dt { color: var(--muted); }
.hw dd { margin: 0; font-family: Consolas, Menlo, monospace; font-size: 13px; word-break: break-all; }
.hw dd.empty { color: #9ca3af; font-family: inherit; }

.apply-no {
    font-family: Consolas, Menlo, monospace;
    font-size: 18px;
    letter-spacing: .5px;
    padding: 10px 14px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    word-break: break-all;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; background: #f9fafb; }
tbody tr:hover { background: #f9fafb; }
td.nowrap { white-space: nowrap; }
.empty-row td { text-align: center; color: var(--muted); padding: 32px; }

.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); }

.checks { display: flex; flex-direction: column; gap: 4px; }
.checks label { display: flex; align-items: center; gap: 8px; font-family: Consolas, Menlo, monospace; font-size: 13px; font-weight: normal; }
.checks .none { color: #9ca3af; font-size: 13px; }

.quick { display: flex; gap: 6px; margin-top: 6px; }

.modal-mask {
    position: fixed; inset: 0;
    background: rgba(17, 24, 39, .45);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    z-index: 10;
}
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 760px; padding: 24px; box-shadow: 0 20px 50px rgba(0, 0, 0, .2); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.close { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); padding: 0 4px; }

.list-recent { margin: 12px 0 0; padding: 0; list-style: none; }
.list-recent li { padding: 4px 0; font-size: 13px; }
