/* Callspire Update — admin panel */

:root {
    --bg-deep: #0c0f14;
    --bg-card: rgba(22, 28, 38, 0.85);
    --bg-elevated: rgba(32, 40, 54, 0.95);
    --border: rgba(120, 140, 180, 0.18);
    --text: #e8ecf4;
    --text-muted: #8b95a8;
    --accent: #3dd6a5;
    --accent-dim: rgba(61, 214, 165, 0.15);
    --danger: #f87171;
    --success: #4ade80;
    --radius: 14px;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    --font: "DM Sans", system-ui, -apple-system, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body.admin-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-deep);
    line-height: 1.55;
}

.admin-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 60% at 20% -10%, rgba(61, 214, 165, 0.12), transparent 50%),
        radial-gradient(ellipse 60% 50% at 100% 20%, rgba(99, 102, 241, 0.08), transparent 45%),
        linear-gradient(165deg, #0c0f14 0%, #111820 50%, #0a0d12 100%);
}

.admin-shell {
    max-width: 920px;
    margin: 0 auto;
    padding: 1.25rem 1.25rem 3rem;
}

.admin-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0 1.75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.brand {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
}

.brand span {
    color: var(--accent);
    font-weight: 600;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.admin-nav a {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid transparent;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.admin-nav a:hover {
    color: var(--text);
    background: var(--accent-dim);
    border-color: rgba(61, 214, 165, 0.25);
}

.admin-nav a.is-active {
    color: var(--bg-deep);
    background: var(--accent);
    border-color: var(--accent);
}

.admin-nav a.nav-external::after {
    content: "↗";
    font-size: 0.7rem;
    margin-left: 0.35rem;
    opacity: 0.7;
}

.page-title {
    margin: 0 0 0.35rem;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-lead {
    max-width: 36rem;
    margin-bottom: 1.75rem;
}

.inline-code {
    font-family: var(--mono);
    font-size: 0.85em;
    padding: 0.15em 0.4em;
    border-radius: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.admin-main {
    animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.75rem 1.85rem;
    margin-bottom: 1.5rem;
}

.card-narrow {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.card h1,
.card h2 {
    margin: 0 0 0.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.card h1 {
    font-size: 1.5rem;
}

.card h2 {
    font-size: 1.1rem;
    color: var(--text);
    margin-top: 1.5rem;
}

.card h2:first-of-type {
    margin-top: 0;
}

.lead {
    margin: 0 0 1.25rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.lead-tight {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-top: 1.1rem;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="file"]:not(.file-picker-native) {
    padding: 0.55rem;
    cursor: pointer;
}

/* Custom file control (Dashboard installer) */
.file-picker {
    position: relative;
    margin-top: 0;
}

.file-picker-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    min-height: 3rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.file-picker:focus-within .file-picker-row {
    border-color: rgba(61, 214, 165, 0.45);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.file-picker-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.15rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #04120d;
    background: linear-gradient(135deg, #3dd6a5, #2eb88a);
    box-shadow: 0 4px 16px rgba(61, 214, 165, 0.22);
    pointer-events: none;
    user-select: none;
}

.file-picker-name {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

input[type="file"].file-picker-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font-size: 0;
}

input[type="file"].file-picker-native:focus {
    outline: none;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: rgba(61, 214, 165, 0.45);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

textarea {
    min-height: 10rem;
    resize: vertical;
    line-height: 1.5;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    cursor: pointer;
}

.checkbox-row input {
    margin-top: 0.2rem;
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-row span {
    font-size: 0.95rem;
    color: var(--text);
}

.btn-row {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.35rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: transform 0.1s, filter 0.15s;
}

.btn-primary,
button[type="submit"] {
    background: linear-gradient(135deg, #3dd6a5, #2eb88a);
    color: #04120d;
    box-shadow: 0 4px 20px rgba(61, 214, 165, 0.25);
}

.btn-primary:hover,
button[type="submit"]:hover {
    filter: brightness(1.06);
}

.btn-primary:active,
button[type="submit"]:active {
    transform: scale(0.98);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.22);
}

.btn-danger:hover {
    filter: brightness(1.06);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: rgba(120, 140, 180, 0.35);
}

.nav-signout-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
}

.nav-signout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.nav-signout-btn:hover {
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.1);
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
}

.alert-err {
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

.alert-ok {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: #bbf7d0;
}

.meta-grid {
    display: grid;
    gap: 0.65rem 1.25rem;
    margin: 1rem 0;
}

@media (min-width: 520px) {
    .meta-grid {
        grid-template-columns: auto 1fr;
    }
}

.meta-grid dt {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.meta-grid dd {
    margin: 0;
    font-size: 0.95rem;
    word-break: break-word;
}

.meta-grid a {
    color: var(--accent);
}

code.hash {
    font-family: var(--mono);
    font-size: 0.78rem;
    word-break: break-all;
    color: #c4d4e8;
}

.notes-block {
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.empty-hint {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0.5rem 0 0;
}

.link-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin: 1rem 0 0;
    font-size: 0.9rem;
}

.link-row a {
    color: var(--accent);
    font-weight: 500;
}

.history-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.8rem;
}

.history-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.65rem 1.2rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
}

.history-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
}

.history-date,
.history-flag {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.history-links {
    display: inline-flex;
    gap: 0.8rem;
}

.history-links a {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 500;
}

.history-links button.history-edit {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    line-height: 1;
}

.history-notes {
    width: 100%;
}

.history-notes-preview {
    margin-top: 0.75rem;
    padding: 0.85rem 0.95rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.12);
    color: var(--text-muted);
    white-space: pre-wrap;
}

.history-notes-editor textarea.history-notes-text {
    width: 100%;
    margin-top: 0.25rem;
}

.admin-footer {
    margin-top: 3rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}
