:root {
    --bg: #f7f7f9;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --accent: #2563eb;
    --accent-soft: #e0e7ff;
    --border: #e2e8f0;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.site-footer {
    padding: 12px 20px;
    font-size: 14px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: var(--card);
    margin-top: 32px;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.4px;
}

.site-nav a {
    color: var(--muted);
    text-decoration: none;
    margin-left: 14px;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}

.site-nav a:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

main.container {
    flex: 1;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 18px 40px;
    width: 100%;
}

.auth-shell {
    min-height: calc(100vh - 140px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 0 40px;
}

.auth-card {
    width: 100%;
    max-width: 520px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}

.panel h1 {
    margin-top: 0;
}

.muted { color: var(--muted); }

.btn {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    background: var(--card);
    transition: background 0.15s ease, border 0.15s ease, color 0.15s ease;
}

.btn.primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.btn.is-active,
.btn.is-active:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.btn.warn,
.btn.warn:hover {
    background: #fffbeb;
    border-color: #fbbf24;
    color: #92400e;
}

.stack {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.flash-messages {
    width: 100%;
    margin: 0 0 16px 0;
}

.flash {
    padding: 14px 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.flash-info { border-color: #cbd5e1; background: #f8fafc; }
.flash-success { border-color: #22c55e; background: #f0fdf4; }
.flash-warning { border-color: #f59e0b; background: #fffbeb; color: #92400e; }
.flash-error { border-color: #fca5a5; background: #fff7f7; color: #991b1b; }

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
}

input, select, textarea {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 14px;
}

textarea {
    resize: vertical;
}

.password-wrap {
    position: relative;
    width: 100%;
    display: block;
}

.password-wrap input[type="password"],
.password-wrap input[type="text"] {
    padding-right: 42px;
    width: 100%;
}

.pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    padding: 4px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pw-toggle:focus {
    outline: 1px solid var(--accent);
    outline-offset: 2px;
}

.accordion {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fbff;
    overflow: hidden;
}

.accordion summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    background: rgba(37, 99, 235, 0.08);
    color: var(--text);
    font-weight: 600;
    user-select: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.accordion summary:hover {
    background: rgba(37, 99, 235, 0.14);
}

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

.accordion .chevron {
    width: 18px;
    height: 18px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--accent);
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.accordion .chevron::before {
    content: "+";
    line-height: 1;
}

.accordion[open] .chevron::before {
    content: "-";
}

.accordion[open] summary {
    background: rgba(37, 99, 235, 0.16);
}

.accordion[open] .chevron {
    transform: rotate(90deg);
    background: var(--accent);
    color: #fff;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    max-width: 520px;
    width: 100%;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
}

.modal .panel-header {
    padding: 18px 22px 0;
}

.modal .stack {
    margin-top: 8px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 22px 20px;
}

.accordion-body {
    padding: 12px 14px 16px;
    animation: fadeSlide 0.28s ease;
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.grid-2.align-inputs .field > span {
    min-height: 36px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

input[type="file"] {
    padding: 8px;
    border: 1px dashed var(--border);
    background: #fff;
}

input[type="file"]::-webkit-file-upload-button,
input[type="file"]::file-selector-button {
    padding: 10px 14px;
    margin-right: 10px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

input[type="file"]::-webkit-file-upload-button:hover,
input[type="file"]::file-selector-button:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

input[type="file"]::-webkit-file-upload-button:active,
input[type="file"]::file-selector-button:active {
    transform: translateY(1px);
}
