/* FD Hub: shared styles for the admin panel, customer account and buy page.
   FD brand: black surfaces, silver gradient primary buttons with black text, chamfered corners. */

:root {
  --bg: #050505;
  --surface: #0f0f11;
  --surface-2: #17171a;
  --input: #0a0a0b;
  --line: #222226;
  --line-strong: #34343a;
  --text: #fafafa;
  --text-2: #a1a1aa;
  --muted: #71717a;
  --silver: linear-gradient(135deg, #c8cbd1 0%, #f4f4f5 50%, #b9bcc3 100%);
  --ok: #4ade80;
  --warn: #f59e0b;
  --bad: #f43f5e;
  --radius: 10px;
  --chamfer: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--text); }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 14px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  padding: 8px 14px; font: 600 13px var(--font); cursor: pointer; border-radius: 0; clip-path: var(--chamfer);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #222227; }
.btn:focus-visible { outline: 2px solid #f4f4f5; outline-offset: 2px; }
.btn.primary { background: var(--silver); color: #0a0a0a; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* forms */
label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; font-weight: 550; }
input, select, textarea {
  width: 100%; background: var(--input); color: var(--text); border: 1px solid var(--line-strong);
  padding: 9px 11px; border-radius: 8px; font: 14px var(--font);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #a1a1aa; box-shadow: 0 0 0 3px rgba(255,255,255,0.08); }
input[type=checkbox] { width: auto; }
.field + .field { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* cards + tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; background: #0b0b0d; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 36px; text-align: center; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-2); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.07); }
.pill.warn { color: var(--warn); border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.07); }
.pill.bad { color: var(--bad); border-color: rgba(244,63,94,0.35); background: rgba(244,63,94,0.07); }

.key { font-family: var(--mono); font-size: 13px; letter-spacing: 0.03em; background: var(--input); border: 1px solid var(--line-strong); padding: 3px 8px; border-radius: 6px; white-space: nowrap; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(6px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; width: 100%; max-width: 560px; padding: 22px; box-shadow: 0 30px 60px rgba(0,0,0,0.6); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* toast */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #f4f4f5; color: #0a0a0a; padding: 10px 16px; border-radius: 8px; font-weight: 600; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.toast.err { background: var(--bad); color: #fff; }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand b { font-size: 15px; letter-spacing: -0.01em; }
.brand span { font-size: 11px; color: var(--muted); display: block; line-height: 1.1; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { justify-content: center; margin-bottom: 22px; }
.notice { border: 1px solid var(--line-strong); background: var(--surface-2); padding: 10px 12px; border-radius: 8px; font-size: 13px; color: var(--text-2); }
.notice.warn { border-color: rgba(245,158,11,0.4); color: #fcd34d; }

@media (max-width: 720px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
