/* Owner panel. Shares the site's palette and buttons (style.css); only what's specific to it lives here. */
/* The owner panel stays a plain light working page, so it keeps the older names for the light palette. */
body.admin {
  min-height: 100vh; background: #e6eaee;
  --indigo: #1f2b54; --madder: #b8433b; --wash: #eef1f5; --sashiko: #fafbfc; --graphite: #262a33;
}

.admin-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 880px; margin: 0 auto; padding: 20px 16px 8px;
}
.admin-brand { display: flex; align-items: center; gap: 12px; color: var(--indigo); text-decoration: none; }
.admin-brand img { display: block; border-radius: 10px; }
.admin-brand span { font: 700 1.15rem/1.1 var(--font-display); letter-spacing: -0.01em; }
.admin-brand em { display: block; font: 600 0.72rem/1.4 var(--font-ui); font-style: normal; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.admin-main { max-width: 880px; margin: 0 auto; padding: 8px 16px 64px; }
.admin-loading { color: var(--muted); padding: 24px 4px; }

.admin-card {
  background: var(--sashiko);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 24px 24px;
  margin-top: 16px;
  box-shadow: 0 10px 24px -18px rgba(31, 43, 84, 0.45);
}
.admin-card h1, .admin-card h2 { font-size: 1.25rem; margin-bottom: 14px; }
.admin-narrow { max-width: 460px; margin-left: auto; margin-right: auto; margin-top: 40px; }
.admin-card code { font: 500 0.85em var(--font-mono); background: var(--wash); border-radius: 6px; padding: 1px 6px; }

/* Login */
#login-form label { display: block; font-weight: 600; margin-bottom: 6px; }
#login-form input, .setting-grid input, .money input {
  width: 100%; padding: 10px 12px;
  font: 500 0.95rem var(--font-ui); color: inherit;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
}
#login-form input:focus, .setting-grid input:focus, .money input:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(31, 43, 84, 0.12); }
#login-form .btn { margin-top: 14px; width: 100%; }

/* Messages */
.admin-error, .admin-warn {
  margin-top: 12px; padding: 10px 14px; border-radius: 12px;
  font-size: 0.88rem; font-weight: 500; line-height: 1.4;
  background: #fff4f2; border: 1.5px solid var(--madder); color: #7c2620;
}
.admin-note { margin-top: 10px; font-size: 0.82rem; color: var(--muted); line-height: 1.4; }
.admin-saved { font-size: 0.88rem; color: #1f5c39; font-weight: 600; }
.admin-empty { padding: 22px 4px; color: var(--muted); }

/* Connections */
.status-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.status-list li { display: flex; align-items: center; gap: 12px; }
.dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #b9c0cc; }
.dot.ok { background: #2e7d4f; box-shadow: 0 0 0 4px rgba(46, 125, 79, 0.16); }
.dot.warn { background: #d99a1e; box-shadow: 0 0 0 4px rgba(217, 154, 30, 0.2); }
.dot.off { background: var(--madder); box-shadow: 0 0 0 4px rgba(184, 67, 59, 0.14); }

/* Problems */
.problems { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.problems li { background: #fff4f2; border: 1.5px solid var(--madder); border-radius: 12px; padding: 10px 14px; overflow-wrap: anywhere; }
.problems time { display: block; font: 600 0.75rem var(--font-ui); color: var(--muted); margin-bottom: 2px; }
.problems .reason { font: 500 0.85rem/1.45 var(--font-mono); color: #7c2620; user-select: all; }
#h-problems + .admin-note { margin-top: 0; }
#problems-empty { padding: 4px 0 12px; }

/* Settings */
.setting { padding: 14px 0; border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: 0; padding-top: 0; }
.switch { position: relative; display: flex; align-items: flex-start; gap: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  flex: none; position: relative; width: 44px; height: 26px; margin-top: 1px;
  border-radius: 999px; background: #b9c0cc; transition: background 0.15s;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--indigo); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--madder); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: 0.5; }
.switch input:disabled ~ .setting-text { opacity: 0.65; }
.setting-text { display: grid; gap: 2px; }
.setting-text span { font-size: 0.85rem; color: var(--muted); line-height: 1.4; }
.setting-text strong { font-size: 0.98rem; }

.setting-grid { border-top: 1px solid var(--line); padding: 16px 0 6px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.setting-title { grid-column: 1 / -1; margin: 0; font: 700 0.98rem var(--font-ui); }
.setting-grid label { display: grid; gap: 6px; font-weight: 600; font-size: 0.88rem; }
.setting-grid .admin-note { grid-column: 1 / -1; margin: 0; }
.money { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.money span { color: var(--muted); }

.admin-actions { display: flex; align-items: center; gap: 16px; margin-top: 18px; }

/* Orders */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--wash); border-radius: 14px; padding: 14px 16px; display: grid; gap: 4px; }
.tile-label { font: 600 0.72rem var(--font-ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.tile-value { font: 500 1.5rem var(--font-mono); color: var(--indigo); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.orders { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 560px; }
.orders th { text-align: left; font: 600 0.72rem var(--font-ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; background: var(--wash); white-space: nowrap; }
.orders td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.orders td:first-child, .orders td.num, .pill { white-space: nowrap; }
.orders td.num { font-family: var(--font-mono); }
.orders td.ref { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: #eef1fb; color: var(--indigo); }
.pill.ai { background: #f6ecfa; color: #66307f; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 0.88rem; color: var(--muted); }
.pager .btn:disabled { opacity: 0.45; cursor: not-allowed; }

@media (max-width: 560px) {
  .admin-card { padding: 18px 16px 20px; }
  .setting-grid, .tiles { grid-template-columns: 1fr; }
  .admin-actions { flex-wrap: wrap; }
}

/* Edit pages */
.page-edit label { display: block; margin: 14px 0 6px; font-weight: 600; }
.page-edit label:first-child { margin-top: 0; }
.page-edit select, .page-edit textarea {
  width: 100%; padding: 10px 12px; font: 500 0.95rem/1.55 var(--font-ui); color: inherit;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
}
.page-edit textarea { min-height: 320px; resize: vertical; }
.page-edit select:focus, .page-edit textarea:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(31, 43, 84, 0.12); }
.admin-help { margin-top: 10px; font-size: 0.88rem; }
.admin-help summary { cursor: pointer; font-weight: 600; color: var(--indigo); }
.admin-help ul { margin: 8px 0 0; padding-left: 1.2em; color: var(--muted); line-height: 1.5; }
.admin-link { align-self: center; font-size: 0.9rem; color: var(--indigo); }
.page-edit .admin-actions { flex-wrap: wrap; align-items: center; }
.page-preview { margin-top: 16px; padding: 16px 20px; background: #fff; border: 1px dashed var(--line); border-radius: 12px; }
.page-preview p { margin: 0 0 10px; line-height: 1.6; }
.page-preview .lead { font-size: 1.1rem; font-weight: 600; color: var(--indigo); }
.page-preview h3 { margin: 18px 0 6px; font-size: 1.05rem; }
.page-preview a { color: var(--indigo); }
