/* System Backups — minimal modern dashboard styling */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f4f5f7; color: #1f2937; font-size: 14px; }

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

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.topbar h1 { font-size: 22px; font-weight: 600; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #10b981; }
.status-dot:not(.green) { background: #9ca3af; }
.user-pill { background: #fee2e2; color: #b91c1c; padding: 4px 10px; 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-radius: 12px; padding: 20px 24px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.stat-label { font-size: 11px; color: #9ca3af; letter-spacing: 1px; font-weight: 600; }
.stat-value { font-size: 32px; font-weight: 700; margin-top: 4px; }
.stat-value.green { color: #10b981; }
.stat-value.blue { color: #3b82f6; }
.stat-value.red { color: #ef4444; }

/* 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-radius: 12px; padding: 20px 24px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.card-title { font-size: 12px; color: #6b7280; letter-spacing: 1px; font-weight: 600; 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: 500; margin-top: 12px; margin-bottom: 4px; font-size: 13px; }
input[type=text], input[type=password], input[type=number], input[type=time], textarea, select {
    width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; background: #fff; font-family: inherit;
}
textarea { font-family: ui-monospace, Menlo, Monaco, monospace; font-size: 12px; }
input:focus, textarea:focus, select:focus { outline: 2px solid #3b82f6; outline-offset: -1px; border-color: #3b82f6; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; margin: 0; font-weight: normal; }
.check input { margin: 0; }

/* 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: 14px; }
.targets-section { display: flex; flex-direction: column; gap: 8px; }
.site-check { background: #f9fafb; padding: 8px 12px; border-radius: 6px; border: 1px solid #f3f4f6; }
.site-check:hover { background: #f3f4f6; }
.targets-label { font-size: 11px; color: #9ca3af; font-weight: 600; letter-spacing: 1px; }
.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: #6b7280; }

/* Buttons */
.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn:hover { background: #f9fafb; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.full { width: 100%; }
.btn-green { background: #10b981; border-color: #10b981; color: #fff; }
.btn-green:hover { background: #059669; }
.btn-icon { background: none; border: none; cursor: pointer; color: #9ca3af; font-size: 18px; padding: 4px 8px; }
.btn-icon:hover { color: #ef4444; }

/* 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; }
.cron-line { display: block; background: #1f2937; color: #d1d5db; padding: 10px 12px; border-radius: 6px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; margin: 8px 0; word-break: break-all; }

/* Alert */
.alert { background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 12px 16px; }
.alert-title { color: #b91c1c; font-weight: 600; 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: 500; }

/* Path display */
.path-display { font-family: ui-monospace, Menlo, Monaco, monospace; font-size: 12px; color: #374151; word-break: break-all; }
.group-list { list-style: none; padding: 0; margin: 4px 0 0 0; }
.group-list li { padding: 6px 0; border-bottom: 1px solid #f3f4f6; }
.group-list li:last-child { border-bottom: none; }

/* Group rows in settings */
.group-row { display: grid; grid-template-columns: 1fr 2fr 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: #9ca3af; letter-spacing: 1px; font-weight: 600; padding: 12px 8px; border-bottom: 1px solid #f3f4f6; }
.backup-table td { padding: 12px 8px; border-bottom: 1px solid #f3f4f6; vertical-align: top; }
.backup-table tr:hover td { background: #fafafa; }
.mono { font-family: ui-monospace, Menlo, Monaco, monospace; font-size: 12px; }
.small { font-size: 12px; }
.muted { color: #6b7280; }
.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: 600; text-transform: lowercase; }
.badge-completed { background: #d1fae5; color: #047857; }
.badge-in_progress { background: #dbeafe; color: #1d4ed8; }
.badge-failed { background: #fee2e2; color: #b91c1c; }
.badge-mysql { background: #ede9fe; color: #6d28d9; }
.badge-sqlite { background: #fef3c7; color: #92400e; }

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

/* Split schedule */
.sched-block { border: 1px solid #f3f4f6; border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; background: #fafbfc; }
.sched-block .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 8px; }

/* Links */
.link { color: #3b82f6; text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.red { color: #ef4444; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal.hidden { display: none; }
.modal-content { background: #fff; border-radius: 12px; 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; }
.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: #374151; }
.progress-bar { width: 100%; height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: #10b981; width: 0%; transition: width 0.4s ease; }

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

/* Test result */
.test-result { margin-top: 12px; padding: 10px 12px; border-radius: 6px; font-size: 13px; }
.test-result.ok { background: #d1fae5; color: #047857; }
.test-result.err { background: #fee2e2; color: #b91c1c; }

/* Misc */
hr { border: none; border-top: 1px solid #f3f4f6; margin: 20px 0; }
.error { background: #fee2e2; color: #b91c1c; padding: 8px 12px; border-radius: 6px; margin-top: 8px; font-size: 13px; }

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