* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --line: #e5e7eb;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px;
}

.page.narrow {
    max-width: 560px;
}

.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: 26px;
}

.hero p {
    margin: 0;
    line-height: 1.6;
    opacity: .92;
}

.admin-link {
    background: rgba(255, 255, 255, .16);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.panel {
    background: var(--panel);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 8px 30px rgba(15, 23, 42, .06);
}

.search-form,
.invoice-form,
.admin-login-form,
.import-form {
    display: grid;
    gap: 12px;
}

label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

input[type="text"],
input[type="password"],
input[type="file"] {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
    background: #fff;
}

input[readonly] {
    background: #f8fafc;
    color: #374151;
}

button {
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.summary-card {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    padding: 16px;
}

.summary-card span {
    display: block;
    font-size: 13px;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.summary-card strong {
    font-size: 24px;
    color: #111827;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.section-title-row h2,
.section-title-row h3 {
    margin: 0;
}

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

.badge {
    background: #eef2ff;
    color: #4338ca;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.invoice-box {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed #d1d5db;
}

.invoice-list {
    display: grid;
    gap: 10px;
}

.invoice-item {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.invoice-name {
    font-weight: 700;
    margin-bottom: 6px;
    word-break: break-all;
}

.right {
    text-align: right;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 14px;
    vertical-align: top;
    white-space: nowrap;
}

.data-table th {
    background: #f8fafc;
    color: #374151;
}

.flash {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 14px;
}

.flash-success {
    background: #ecfdf5;
    color: #047857;
}

.flash-error {
    background: #fef2f2;
    color: #b91c1c;
}

.hint,
.empty-text {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.top-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.anchor-section {
    scroll-margin-top: 18px;
}

.hero-search-input {
    min-height: 115px;
    padding: 18px 16px;
    font-size: 22px;
    line-height: 1.5;
}
