* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f6f7f9;
    color: #1f2937;
    font-family: "Inter", "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(420px, 100%);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    padding: 28px;
    box-shadow: 0 12px 36px rgba(15, 23, 42, .08);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
}

.sidebar {
    background: #111827;
    color: #f9fafb;
    padding: 22px 18px;
}

.brand {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 22px;
}

.nav-link {
    display: block;
    border-radius: 8px;
    color: #d1d5db;
    padding: 10px 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

.nav-link:hover,
.nav-link.active {
    background: #1f2937;
    color: #fff;
}

.main {
    min-width: 0;
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.muted {
    color: #6b7280;
    font-size: 13px;
}

.grid {
    display: grid;
    gap: 14px;
}

.stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}

.card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: 16px;
}

.stat-value {
    font-size: 26px;
    font-weight: 850;
    margin-top: 4px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
}

.field {
    display: grid;
    gap: 6px;
}

.label {
    color: #4b5563;
    font-size: 12px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #fff;
    padding: 8px 10px;
    color: #111827;
    font: inherit;
}

textarea {
    min-height: 112px;
    resize: vertical;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid #0f766e;
    border-radius: 7px;
    background: #0f766e;
    color: #fff;
    padding: 8px 13px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.button.secondary {
    border-color: #d1d5db;
    background: #fff;
    color: #374151;
}

.tool-panel summary {
    width: fit-content;
    list-style: none;
}

.tool-panel summary::-webkit-details-marker {
    display: none;
}

.tool-panel-body {
    margin-top: 16px;
}

.settings-license-module-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.client-inline-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.2fr) auto;
    gap: 12px;
    align-items: end;
}

.compact-client-card {
    padding: 10px 12px;
}

.compact-client-form {
    grid-template-columns: 180px 230px auto;
    gap: 8px;
}

.compact-client-form .field,
.license-adjust-form .field {
    gap: 3px;
}

.compact-client-form .label,
.license-adjust-form .label {
    font-size: 11px;
}

.compact-client-form input,
.license-adjust-form input,
.license-adjust-form select {
    min-height: 30px;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 13px;
}

.compact-client-form .button,
.license-adjust-form .button {
    min-height: 30px;
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 12px;
}

.license-adjust-card {
    padding: 12px;
}

.license-adjust-card h2 {
    margin: 0 0 8px;
    font-size: 15px;
    line-height: 1.25;
}

.license-adjust-form {
    display: grid;
    grid-template-columns: minmax(150px, 1.3fr) minmax(180px, 1.5fr) 92px 82px 124px 124px 82px 82px 104px auto;
    gap: 8px;
    align-items: end;
}

.license-adjust-actions {
    display: flex;
    gap: 6px;
    align-items: end;
    white-space: nowrap;
}

.generator-grid {
    display: grid;
    grid-template-columns: 140px minmax(250px, 1.4fr) minmax(180px, 1fr) 160px 160px;
    gap: 12px;
    align-items: end;
}

.generator-grid .site-field {
    min-width: 0;
}

.generator-submit {
    align-self: end;
    white-space: nowrap;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

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

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

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

th,
td {
    border-bottom: 1px solid #eef0f3;
    padding: 11px 10px;
    text-align: left;
    vertical-align: middle;
    font-size: 13px;
}

th {
    color: #6b7280;
    font-size: 12px;
    font-weight: 850;
    background: #f9fafb;
}

.mono {
    font-family: "JetBrains Mono", "Consolas", monospace;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 8px;
    background: #ecfdf5;
    color: #047857;
    font-size: 12px;
    font-weight: 800;
}

.badge.warn {
    background: #fffbeb;
    color: #b45309;
}

.badge.danger {
    background: #fef2f2;
    color: #b91c1c;
}

.alert {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.success {
    border: 1px solid #99f6e4;
    background: #f0fdfa;
    color: #115e59;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.two-col {
    grid-template-columns: minmax(0, 1fr) 360px;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
    }
    .stats,
    .form-grid,
    .client-inline-form,
    .license-adjust-form,
    .generator-grid,
    .two-col {
        grid-template-columns: 1fr;
    }
    .span-2,
    .span-4 {
        grid-column: auto;
    }
}

