/* SFTP Exchange admin portal - neutral, accessible styling. No external resources. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1c2733;
  --muted: #5b6875;
  --border: #d5dbe1;
  --border-strong: #b7c0c9;
  --primary: #1d4f73;
  --primary-hover: #163d59;
  --primary-soft: #e7eff5;
  --danger: #b42318;
  --danger-hover: #912018;
  --danger-soft: #fdecea;
  --warning-soft: #fff6e0;
  --warning-border: #e3b341;
  --success: #1e7a46;
  --success-soft: #e6f4ec;
  --info-soft: #eaf1f8;
  --focus: #2b7bd6;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
h1 { font-size: 1.6rem; margin: 0 0 0.5rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
h1:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--surface); padding: 0.5rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; top: 0.5rem; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1280px; margin: 0 auto; padding: 0.6rem 1.5rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand-logo { display: block; height: 29px; width: auto; }
.brand-product { color: var(--muted); font-size: 0.9rem; padding-left: 0.6rem; border-left: 1px solid var(--border); }
.splash { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; text-align: center; }
.splash > img { height: 34px; width: auto; }
.splash .narrow { text-align: left; }
.splash-title { margin: 0; font-size: 1.4rem; }
.splash-text { margin: 0; color: var(--muted); max-width: 32rem; }
.main-nav { display: flex; gap: 0.25rem; }
.main-nav a { text-decoration: none; color: var(--text); padding: 0.4rem 0.75rem; border-radius: var(--radius); font-weight: 500; }
.main-nav a:hover { background: var(--bg); }
.main-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.user-email { color: var(--muted); font-size: 0.9rem; }
.server-info { background: var(--bg); border-top: 1px solid var(--border); font-size: 0.88rem; }
.server-info .header-inner { padding-top: 0.4rem; padding-bottom: 0.4rem; gap: 0.5rem 2rem; }
.info-item { display: inline-flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.info-label { color: var(--muted); }
.mock-banner { background: var(--warning-soft); border-top: 1px solid var(--warning-border); text-align: center; padding: 0.35rem 1rem; font-size: 0.88rem; font-weight: 600; }

/* Layout */
.main { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }
.main:focus { outline: none; }
.narrow { max-width: 760px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.page-head h1 { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0; }
.lead { color: var(--muted); margin: 0 0 1.25rem; }
.crumbs { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.9rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; align-items: start; }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + * { margin-top: 1.25rem; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

.toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.toolbar input[type="search"] { width: 280px; max-width: 100%; }
.count { margin: 0 0 0 auto; font-size: 0.9rem; }
.inline-field { display: flex; align-items: center; gap: 0.5rem; }
.inline-field label { font-weight: 600; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; border: 1px solid transparent; border-radius: var(--radius); padding: 0.5rem 1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-link { background: none; color: var(--primary); padding-left: 0.25rem; padding-right: 0.25rem; }
.btn-link:hover { text-decoration: underline; }
.btn-small { padding: 0.3rem 0.65rem; font-size: 0.85rem; }

/* Forms */
.form .field, .field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.2rem; }
.optional { font-weight: 400; color: var(--muted); }
.field-help { margin: 0 0 0.4rem; color: var(--muted); font-size: 0.88rem; }
.field-error { margin: 0.35rem 0 0; color: var(--danger); font-size: 0.88rem; font-weight: 600; }
.input { display: block; width: 100%; padding: 0.5rem 0.65rem; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); }
textarea.input { resize: vertical; min-height: 5rem; }
select.input { width: auto; }
.input-narrow { max-width: 10rem; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input.mono { font-family: var(--mono); }
.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 0.5rem; }
.ack { display: flex; align-items: flex-start; gap: 0.5rem; }
.ack input { margin-top: 0.3rem; width: 1rem; height: 1rem; flex: none; }
.ack label { font-weight: 400; margin: 0; }
.checkbox-block { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; margin: 1rem 0; }
.checkbox-block .field-help { margin: 0.35rem 0 0 1.5rem; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { background: #eef1f4; font-weight: 600; color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: none; }
.table-clickable tbody tr { cursor: pointer; }
.table-clickable tbody tr:hover { background: var(--primary-soft); }
.table td.num { white-space: nowrap; }
.table td.empty { text-align: center; color: var(--muted); padding: 2rem; cursor: default; }
.row-deleted td { color: var(--muted); }
.strong-link { font-weight: 600; }
.details-cell { color: var(--muted); word-break: break-word; }

/* Detail list */
.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.45rem 1.25rem; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-word; }
.actions { display: flex; flex-direction: column; gap: 1rem; }
.action .btn { min-width: 10rem; }
.action .field-help { margin: 0.3rem 0 0; }

/* Badges */
.badges { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; vertical-align: middle; }
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.badge-active { background: var(--success-soft); color: var(--success); border-color: #b5dcc5; }
.badge-disabled { background: #eceff2; color: #4a5561; border-color: var(--border-strong); }
.badge-deleted { background: var(--danger-soft); color: var(--danger); border-color: #f3c1bc; }
.badge-locked { background: var(--warning-soft); color: #8a5a00; border-color: var(--warning-border); }

/* Alerts and toasts */
.alert { border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0.75rem 0; border: 1px solid; }
.alert-error { background: var(--danger-soft); border-color: #f3c1bc; color: #7a1a12; }
.alert-warning { background: var(--warning-soft); border-color: var(--warning-border); color: #5c3d00; }
.alert-info { background: var(--info-soft); border-color: #c4d6e8; color: #1d3b57; }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 50; max-width: 420px; }
.toast { background: var(--text); color: #fff; padding: 0.7rem 1rem; border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }

.loading { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Dialogs */
.dialog { border: none; border-radius: 8px; padding: 0; width: min(560px, calc(100vw - 2rem)); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); color: var(--text); }
.dialog::backdrop { background: rgba(16, 24, 40, 0.55); }
.dialog-credentials { width: min(680px, calc(100vw - 2rem)); }
.dialog-title { padding: 1.1rem 1.25rem 0; margin: 0; font-size: 1.2rem; }
.dialog-body { padding: 0.75rem 1.25rem; }
.dialog-body p { margin: 0 0 0.75rem; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 0.75rem 1.25rem 1.1rem; border-top: 1px solid var(--border); }
.cred-grid { display: grid; gap: 0.5rem; margin: 1rem 0; }
.cred-row { display: grid; grid-template-columns: 6rem 1fr auto; align-items: center; gap: 0.75rem; }
.cred-label { font-weight: 600; color: var(--muted); }
.cred-row .btn { min-width: 10rem; }
.cred-value { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.4rem 0.6rem; word-break: break-all; user-select: all; }
.cred-secret { font-weight: 700; letter-spacing: 0.02em; }
.cred-download { margin-bottom: 1rem; }

/* v2 additions */
.badge-pending { background: var(--info-soft); color: #1d3b57; border-color: #c4d6e8; }
.field-note { margin: 0.4rem 0 0; padding: 0.4rem 0.6rem; background: var(--warning-soft); border-left: 3px solid var(--warning-border); font-size: 0.88rem; color: #5c3d00; }
.warning-list { margin: 0.35rem 0 0.25rem; padding-left: 1.25rem; }
.warning-foot { margin: 0; font-size: 0.88rem; }
.card-locked { border-color: var(--warning-border); background: #fffcf3; }
.card-locked p { margin: 0 0 0.75rem; }
.spinner-inline { display: inline-block; width: 14px; height: 14px; border-width: 2px; vertical-align: -2px; margin-right: 0.4rem; }
.grid + .card, .card-locked + .grid { margin-top: 1.25rem; }
