* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    background: #f4f7fb;
    color: #1f2937;
}
a {
    color: #2563eb;
    text-decoration: none;
}
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 18px;
}
.center-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card, .panel {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 10px 35px rgba(15, 23, 42, .08);
    padding: 26px;
}
.redeem-card, .login-card {
    width: 100%;
    max-width: 460px;
}
h1, h2 {
    margin-top: 0;
}
.muted {
    color: #6b7280;
    line-height: 1.7;
}
label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}
.input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 15px;
    background: #fff;
}
.code-input {
    font-size: 20px;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    background: #e5e7eb;
    color: #111827;
}
.btn-primary {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #fff;
}
.btn-small {
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
}
.full {
    width: 100%;
    margin-top: 18px;
}
.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin: 14px 0;
}
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.alert-ok {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.footer-link {
    margin-top: 18px;
    text-align: center;
}
.layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 230px;
    background: #0f172a;
    color: #fff;
    padding: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar h2 {
    font-size: 20px;
    margin-bottom: 24px;
}
.sidebar a {
    display: block;
    color: #dbeafe;
    padding: 11px 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.main {
    flex: 1;
    padding: 28px;
    overflow-x: hidden;
}
.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0;
}
.stats div {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}
.stats strong {
    display: block;
    font-size: 28px;
    color: #2563eb;
}
.stats span {
    color: #6b7280;
}
.panel {
    margin: 18px 0;
}
.grid-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 14px;
    align-items: end;
}
.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 850px;
}
th, td {
    border-bottom: 1px solid #e5e7eb;
    padding: 11px 9px;
    text-align: left;
    vertical-align: middle;
}
th {
    color: #374151;
    background: #f9fafb;
}
code {
    background: #f3f4f6;
    padding: 3px 6px;
    border-radius: 6px;
}
.tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
}
.tag.used {
    background: #fee2e2;
    color: #991b1b;
}
.tag.unused {
    background: #dcfce7;
    color: #166534;
}
.link-danger {
    border: 0;
    background: none;
    color: #dc2626;
    cursor: pointer;
    padding: 0;
}
.code-box {
    margin-top: 18px;
}
.code-box-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
textarea {
    width: 100%;
    min-height: 160px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 12px;
    font-family: monospace;
}
.file-info {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px 16px;
    margin: 16px 0;
}
.file-info p {
    margin: 8px 0;
    word-break: break-all;
}
@media (max-width: 900px) {
    .layout {
        display: block;
    }
    .sidebar {
        width: auto;
        height: auto;
        position: static;
    }
    .main {
        padding: 18px;
    }
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .grid-form {
        grid-template-columns: 1fr;
    }
}
