/* FTAQUIO Admin styles. Brand-matched with the marketing page. */

:root {
  --navy: #1877f2;
  --navy-deep: #0d5dc9;
  --navy-soft: #4293f5;
  --gold: #4293f5;
  --gold-light: #b3d4ff;
  --cream: #f0f2f5;
  --cream-2: #e4e6eb;
  --text: #1c1e21;
  --text-soft: #65676b;
  --muted: #8a8d91;
  --line: #dadde1;
  --bg: #ffffff;
  --danger: #d92d20;
  --success: #15803d;
  --warning: #b45309;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text); background: var(--cream);
  font-size: 14px; line-height: 1.55;
}
a { color: var(--navy); }

.muted { color: var(--text-soft); }
.small { font-size: 0.85rem; }

/* ---------- Login page ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--cream) 0%, #d6e4ff 100%);
  padding: 1.5rem;
}
.login-card {
  width: 100%; max-width: 420px;
  background: #fff;
  border-radius: 12px;
  padding: 2.25rem 2rem 2rem;
  box-shadow: 0 10px 40px rgba(13, 93, 201, 0.12);
  border: 1px solid var(--line);
}
.login-brand {
  display: flex; align-items: center; gap: 0.85rem;
  margin-bottom: 1.5rem;
}
.brand-mark {
  width: 46px; height: 46px;
  background: var(--navy);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Lora', Georgia, serif;
  font-weight: 700; font-size: 1.5rem; font-style: italic;
  border-radius: 6px;
}
.brand-mark.small { width: 36px; height: 36px; font-size: 1.15rem; border-radius: 5px; }
.brand-name { font-weight: 800; color: var(--navy); letter-spacing: 0.5px; }
.brand-tag { color: var(--text-soft); font-size: 0.7rem; letter-spacing: 2px; text-transform: uppercase; }
.login-card h1 { font-size: 1.5rem; color: var(--navy); margin-bottom: 0.35rem; font-weight: 700; }
.login-card form { margin-top: 1.4rem; display: flex; flex-direction: column; gap: 0.5rem; }
.login-card label { font-size: 0.85rem; font-weight: 600; color: var(--text-soft); margin-top: 0.6rem; }
.login-card input {
  padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  font-size: 1rem;
  background: #fff;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.15);
}
button.btn-primary, .btn-primary {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  font-family: inherit;
}
button.btn-primary:hover { background: var(--navy-deep); }
button.btn-primary:active { transform: translateY(1px); }
button.btn-primary[disabled] { background: var(--muted); cursor: not-allowed; }
.error {
  margin-top: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: #fef0f0;
  border: 1px solid #f5c2c2;
  color: var(--danger);
  border-radius: 6px;
  font-size: 0.9rem;
}

/* ---------- App layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 1.25rem 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  display: flex; gap: 0.7rem; align-items: center;
  text-decoration: none; padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.sidebar nav {
  display: flex; flex-direction: column;
  padding: 1rem 0.75rem;
  flex: 1;
}
.sidebar nav a {
  padding: 0.65rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.12s, color 0.12s;
}
.sidebar nav a:hover { background: var(--cream); color: var(--navy); }
.sidebar nav a.active { background: var(--navy); color: #fff; }
.sidebar nav a.external { color: var(--muted); font-weight: 500; margin-top: auto; }
.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 1rem 1.25rem;
}
.sidebar-foot .logout {
  display: inline-block; margin-top: 0.5rem;
  font-size: 0.85rem; color: var(--danger); text-decoration: none;
}
.sidebar-foot .logout:hover { text-decoration: underline; }

.content { flex: 1; padding: 1.75rem 2rem 3rem; max-width: 1280px; }

/* ---------- Cards / page header ---------- */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; color: var(--navy); font-weight: 700; }
.page-header .actions { display: flex; gap: 0.5rem; }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.card h2 { font-size: 1.05rem; color: var(--navy); margin-bottom: 0.85rem; font-weight: 700; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 1.25rem 1.5rem;
}
.stat .label { color: var(--text-soft); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat .value { font-size: 2rem; font-weight: 700; color: var(--navy); margin-top: 0.25rem; }

/* ---------- Tables ---------- */
table.data {
  width: 100%; border-collapse: collapse;
  background: #fff;
}
table.data th, table.data td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  vertical-align: top;
}
table.data th {
  background: var(--cream);
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--line);
}
table.data tbody tr:hover { background: #fafbfc; }
table.data tbody tr.clickable { cursor: pointer; }
table.data .mono { font-family: 'SF Mono', Menlo, monospace; font-size: 0.82rem; }
table.data .badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--cream-2); color: var(--text-soft);
}
table.data .badge.success { background: #dcfce7; color: var(--success); }
table.data .badge.danger  { background: #fef0f0; color: var(--danger); }
table.data .badge.warn    { background: #fef3c7; color: var(--warning); }

/* ---------- Forms ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem 1.25rem;
}
.field { display: flex; flex-direction: column; gap: 0.25rem; }
.field label {
  font-size: 0.78rem; font-weight: 600; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.field input, .field select, .field textarea {
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  font-size: 0.92rem;
  font-family: inherit;
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.12);
}
.field input[readonly] { background: var(--cream); color: var(--text-soft); }
.field-row { grid-column: 1 / -1; }
.field-row textarea { min-height: 200px; font-family: 'SF Mono', Menlo, monospace; font-size: 0.78rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: 6px;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.12s, transform 0.05s, color 0.12s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-deep); }
.btn.secondary { background: var(--cream-2); color: var(--text); }
.btn.secondary:hover { background: var(--line); }
.btn.danger { background: #fef0f0; color: var(--danger); }
.btn.danger:hover { background: #fde0e0; }
.btn.small { padding: 0.35rem 0.65rem; font-size: 0.82rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Search bar ---------- */
.searchbar {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.searchbar input, .searchbar select {
  padding: 0.55rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  font-size: 0.92rem;
  font-family: inherit;
  background: #fff;
}
.searchbar input.q { flex: 2; min-width: 220px; }
.searchbar input.tin { flex: 1; min-width: 130px; }
.searchbar input.rdo { width: 90px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 1rem; right: 1rem; z-index: 999;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  background: var(--text); color: #fff;
  font-size: 0.9rem; font-weight: 500;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.danger  { background: var(--danger); }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(28, 30, 33, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal {
  background: #fff;
  border-radius: 10px;
  max-width: 540px; width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  position: relative;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-close {
  position: absolute; top: 0.75rem; right: 0.75rem;
  width: 32px; height: 32px;
  border: none; background: transparent;
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  color: var(--text-soft);
  border-radius: 4px;
}
.modal-close:hover { background: var(--cream); }
.modal h2 { color: var(--navy); margin-bottom: 0.85rem; font-size: 1.15rem; }
.modal .key-display {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 0.95rem;
  background: var(--cream);
  padding: 0.85rem;
  border-radius: 6px;
  word-break: break-all;
  border: 1px solid var(--line);
  margin: 0.75rem 0;
}
.modal .warn-box {
  padding: 0.7rem 0.9rem;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 6px;
  color: var(--warning);
  font-size: 0.85rem;
  margin: 0.5rem 0 1rem;
}

.empty { padding: 2rem; text-align: center; color: var(--text-soft); }

/* Detail page two-column layout */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .sidebar nav { flex-direction: row; overflow-x: auto; }
}
