/* System Backups — black / white / blue dashboard theme */
:root {
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --blue-light: #60a5fa;
    --blue-bg: #eff6ff;
    --ink: #0f172a;
    --ink-soft: #1e293b;
    --text: #111827;
    --muted: #64748b;
    --border: #e2e8f0;
    --border-soft: #eef2f6;
    --page: #f1f5f9;
    --red: #dc2626;
    --red-bg: #fef2f2;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--page); color: var(--text); font-size: 14px; }

.app { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* Top bar — white header */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; background: #fff; color: var(--ink); padding: 16px 24px; border-radius: 12px; border: 1px solid var(--border); }
.topbar h1 { font-size: 20px; font-weight: 700; margin: 0; color: var(--ink); letter-spacing: 0.2px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-right .muted { color: var(--muted); }
.topbar-right .link { color: var(--blue); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.status-dot:not(.green) { background: #cbd5e1; }
.user-pill { background: var(--blue); color: #fff; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 18px 22px; }
.stat-label { font-size: 11px; color: var(--muted); letter-spacing: 1px; font-weight: 700; }
.stat-value { font-size: 32px; font-weight: 700; margin-top: 4px; color: var(--ink); }
.stat-value.green { color: var(--blue); }
.stat-value.blue { color: var(--blue-light); }
.stat-value.red { color: var(--red); }

/* Grid */
.grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.col-main, .col-side { display: flex; flex-direction: column; gap: 16px; }

/* Cards */
.card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; }
.card-title { font-size: 12px; color: var(--ink); letter-spacing: 1px; font-weight: 700; margin-bottom: 12px; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-title-row .card-title { margin-bottom: 0; }

/* Forms */
label { display: block; font-weight: 600; margin-top: 12px; margin-bottom: 4px; font-size: 13px; color: var(--ink-soft); }
input[type=text], input[type=password], input[type=number], input[type=time], textarea, select {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; font-family: inherit; color: var(--text);
}
textarea { font-family: ui-monospace, Menlo, Monaco, monospace; font-size: 12px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; margin: 0; font-weight: normal; }
.check input { margin: 0; accent-color: var(--blue); }
input[type=checkbox] { accent-color: var(--blue); }

/* Backup form */
.backup-form { display: flex; flex-direction: column; gap: 14px; }
.targets { display: flex; flex-wrap: wrap; gap: 16px; }
.targets.vertical { flex-direction: column; gap: 0; }
.targets-section { display: flex; flex-direction: column; }
/* Website rows: one bordered container, compact rows with thin dividers */
.targets-section .site-check:first-of-type { border-top: 1px solid var(--border); border-radius: 9px 9px 0 0; }
.targets-section .site-check:last-of-type { border-radius: 0 0 9px 9px; }
.site-check { display: flex; align-items: center; gap: 10px; background: #fff; padding: 8px 14px; border: 1px solid var(--border); border-top: none; transition: background 0.12s; }
.site-check:hover { background: var(--blue-bg); }
.site-check strong { font-weight: 600; font-size: 13px; }
.site-meta { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted); background: #f1f5f9; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.targets-label { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: 1px; margin-bottom: 8px; }
.backup-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.notes-input { flex: 1; min-width: 200px; }
.storage-note { margin-top: 12px; font-size: 13px; color: var(--muted); }

/* Buttons */
.btn { display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-soft); transition: background 0.15s, border-color 0.15s; }
.btn:hover { background: var(--blue-bg); border-color: var(--blue-light); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn.full { width: 100%; }
/* Primary action button (class name kept as btn-green for back-compat — it is blue) */
.btn-green { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-green:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 18px; padding: 4px 8px; }
.btn-icon:hover { color: var(--red); }

/* Schedule row */
.schedule-form .row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0; }
.schedule-form .row label { margin-top: 0; }

/* Cron help */
.cron-help { margin-top: 12px; }
.cron-help summary { cursor: pointer; color: var(--muted); }
.cron-line { display: block; background: var(--ink); color: #cbd5e1; padding: 10px 12px; border-radius: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; margin: 8px 0; word-break: break-all; }

/* Alert */
.alert { background: var(--red-bg); border: 1px solid #fecaca; border-radius: 10px; padding: 12px 16px; }
.alert-title { color: var(--red); font-weight: 700; margin-bottom: 4px; }
.alert-body { color: #7f1d1d; font-size: 13px; }
.force-restore { display: block; margin-top: 10px; padding-top: 10px; border-top: 1px solid #fecaca; color: #7f1d1d; }

/* GCS panel */
.gcs-status { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; }

/* Path display */
.path-display { font-family: ui-monospace, Menlo, Monaco, monospace; font-size: 11px; color: var(--muted); word-break: break-all; display: block; }
.path-display.sub { margin-top: 3px; }
.group-list { list-style: none; padding: 0; margin: 4px 0 0 0; }
.group-list li { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.group-list li:last-child { border-bottom: none; }
.ws-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ws-head strong { font-size: 13px; }

/* Group rows in settings */
.group-row { display: grid; grid-template-columns: 1fr 2fr auto auto; gap: 8px; margin-bottom: 8px; align-items: center; }

/* Table */
.table-wrap { overflow-x: auto; }
.backup-table { width: 100%; border-collapse: collapse; }
.backup-table th { text-align: left; font-size: 11px; color: var(--muted); letter-spacing: 1px; font-weight: 700; padding: 12px 8px; border-bottom: 2px solid var(--border); }
.backup-table td { padding: 12px 8px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.backup-table tr:hover td { background: var(--blue-bg); }
.mono { font-family: ui-monospace, Menlo, Monaco, monospace; font-size: 12px; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.actions { white-space: nowrap; }
.actions .link { margin-right: 12px; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: lowercase; }
.badge-completed { background: var(--blue-bg); color: var(--blue-dark); }
.badge-in_progress { background: #e0e7ff; color: #3730a3; }
.badge-queued { background: #f1f5f9; color: #64748b; }
.badge-running { background: #e0e7ff; color: #3730a3; animation: badge-pulse 1.2s ease-in-out infinite; }
@keyframes badge-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.badge-failed { background: var(--red-bg); color: var(--red); }
.badge-mysql { background: var(--ink); color: #fff; }
.badge-sqlite { background: #e2e8f0; color: var(--ink-soft); }

/* Backup-type button row */
.backup-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.backup-buttons .btn { flex: 0 0 auto; }

/* Destructive button */
.btn-red { background: var(--red-bg); color: var(--red); border-color: #fecaca; }
.btn-red:hover { background: #fee2e2; border-color: #fca5a5; }

/* Server storage bar */
.disk-bar { width: 100%; height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.disk-fill { height: 100%; transition: width 0.4s ease; }
.disk-fill.green { background: var(--blue); }
.disk-fill.yellow { background: #f59e0b; }
.disk-fill.red { background: var(--red); }

/* Split schedule */
.sched-block { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: #fff; }
.sched-block.is-off { background: #f8fafc; }
.sched-block .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.sched-head { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 0; }
.sched-head input[type=checkbox] { width: 17px; height: 17px; }
.sched-head strong { font-size: 14px; }
.sched-state { margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; padding: 3px 12px; border-radius: 999px; }
.sched-block:not(.is-off) .sched-state { background: var(--blue); color: #fff; }
.sched-block.is-off .sched-state { background: #e2e8f0; color: var(--muted); }
.sched-fields { transition: opacity 0.15s; }
.sched-block.is-off .sched-fields { opacity: 0.4; }

/* Links */
.link { color: var(--blue); text-decoration: none; cursor: pointer; font-weight: 600; }
.link:hover { text-decoration: underline; }
.link.red { color: var(--red); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,0.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal.hidden { display: none; }
.modal-content { background: #fff; border-radius: 14px; padding: 24px; max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { margin: 0; color: var(--ink); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Progress */
.progress { width: 100%; margin-top: 12px; }
.progress.hidden { display: none; }
.progress-label { font-size: 13px; margin-bottom: 6px; color: var(--ink-soft); }
.progress-bar { width: 100%; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); width: 0%; transition: width 0.4s ease; }

/* Auth page */
.auth-body { background: var(--ink); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-box { background: #fff; padding: 36px; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,0.35); max-width: 380px; width: 90%; }
.auth-box.wide { max-width: 720px; }
.auth-box h1 { margin: 0 0 4px 0; font-size: 22px; color: var(--ink); }

/* Test result */
.test-result { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.test-result.ok { background: var(--blue-bg); color: var(--blue-dark); }
.test-result.err { background: var(--red-bg); color: var(--red); }

/* Failed-row error text in the backups table */
.row-error { margin-top: 4px; font-family: -apple-system, sans-serif; font-size: 11px; color: var(--red); white-space: pre-wrap; word-break: break-word; max-width: 360px; }

/* Misc */
hr { border: none; border-top: 1px solid var(--border-soft); margin: 20px 0; }
.error { background: var(--red-bg); color: var(--red); padding: 9px 12px; border-radius: 8px; margin-top: 8px; font-size: 13px; }
code { background: #f1f5f9; color: var(--ink-soft); padding: 1px 6px; border-radius: 4px; font-family: ui-monospace, Menlo, Monaco, monospace; font-size: 12px; }

@media (max-width: 900px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .grid { grid-template-columns: 1fr; }
    .schedule-form .row { grid-template-columns: 1fr; }
}
