/* ============================================================
   THE DETAIL DUDES — Back Office (login + dashboard)
   Shares the "Midnight Sapphire" tokens with the marketing site.
   Self-contained so it never depends on the marketing styles.
   ============================================================ */

:root {
  --bg:        #060a13;
  --bg-2:      #080d18;
  --surface:   #0c1322;
  --surface-2: #111a2d;
  --line:      rgba(62, 168, 255, 0.15);
  --line-strong: rgba(62, 168, 255, 0.36);
  --accent:      #3ea8ff;
  --accent-bright:#bfe1ff;
  --accent-deep: #1668c0;
  --ivory:     #eef3fa;
  --muted:     #9fabc2;
  --muted-2:   #6b7890;
  --danger:    #e06c75;
  --ok:        #5cc98a;
  --warn:      #e6b455;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Manrope', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-card: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul { list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.serif { font-family: var(--serif); }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-weight: 600; font-size: 0.95rem; line-height: 1;
  padding: 0.8rem 1.2rem; border-radius: 999px;
  min-height: 44px; transition: transform .15s var(--ease), background .2s, border-color .2s, opacity .2s;
  border: 1px solid transparent; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-accent { background: linear-gradient(180deg, var(--accent-bright), var(--accent)); color: #04101e; }
.btn-accent:hover:not([disabled]) { background: linear-gradient(180deg, #d6ecff, var(--accent)); }
.btn-ghost { border-color: var(--line-strong); color: var(--ivory); background: rgba(62,168,255,0.04); }
.btn-ghost:hover:not([disabled]) { background: rgba(62,168,255,0.1); }
.btn-danger { border-color: rgba(224,108,117,0.5); color: #ffd7da; background: rgba(224,108,117,0.08); }
.btn-danger:hover:not([disabled]) { background: rgba(224,108,117,0.16); }
.btn-sm { min-height: 36px; padding: 0.45rem 0.8rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---------- Form fields ---------- */
.field { display: block; margin-bottom: 1rem; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 0.4rem; letter-spacing: 0.02em; }
.input, select.input {
  width: 100%; font-family: inherit; font-size: 1rem; color: var(--ivory);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.75rem 0.9rem; min-height: 46px; transition: border-color .2s, background .2s;
  appearance: none;
}
.input:focus { border-color: var(--accent); background: #0a1322; outline: none; }
.input::placeholder { color: var(--muted-2); }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239fabc2' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.9rem center; padding-right: 2.2rem; }

/* ---------- Feedback ---------- */
.alert { border-radius: 10px; padding: 0.7rem 0.9rem; font-size: 0.9rem; margin-bottom: 1rem; border: 1px solid; }
.alert-error { color: #ffd7da; background: rgba(224,108,117,0.1); border-color: rgba(224,108,117,0.4); }
.alert-ok { color: #cdebd9; background: rgba(92,201,138,0.1); border-color: rgba(92,201,138,0.4); }

/* ============================================================
   LOGIN
   ============================================================ */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(62,168,255,0.14), transparent 60%),
    var(--bg);
}
.auth-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 2.2rem 1.9rem; box-shadow: var(--shadow-card);
}
.auth-logo { display: flex; align-items: center; gap: 0.7rem; justify-content: center; margin-bottom: 0.4rem; }
.auth-logo img { width: 42px; height: 42px; }
.auth-title { font-family: var(--serif); font-size: 1.7rem; text-align: center; font-weight: 600; }
.auth-title em { font-style: italic; color: var(--accent-bright); }
.auth-sub { text-align: center; color: var(--muted); font-size: 0.92rem; margin: 0.3rem 0 1.6rem; }
.auth-foot { text-align: center; margin-top: 1.4rem; font-size: 0.85rem; }
.auth-foot a { color: var(--muted); }

/* ============================================================
   DASHBOARD SHELL
   ============================================================ */
.app-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.8rem clamp(1rem, 3vw, 1.8rem);
  background: rgba(8,13,24,0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.app-bar .brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; }
.app-bar .brand img { width: 32px; height: 32px; }
.app-bar .brand small { display: block; font-weight: 500; font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted-2); }
.app-bar .spacer { flex: 1; }
.who { text-align: right; line-height: 1.25; }
.who .who-name { font-weight: 600; font-size: 0.92rem; }

.role-badge {
  display: inline-block; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 0.18rem 0.5rem; border-radius: 999px; border: 1px solid;
}
.role-admin   { color: var(--accent-bright); background: rgba(62,168,255,0.12); border-color: var(--line-strong); }
.role-manager { color: var(--warn); background: rgba(230,180,85,0.1); border-color: rgba(230,180,85,0.4); }
.role-employee{ color: var(--muted); background: rgba(159,171,194,0.08); border-color: var(--line); }

.app-layout { display: grid; grid-template-columns: 232px 1fr; min-height: calc(100vh - 61px); }
.side {
  border-right: 1px solid var(--line); padding: 1.2rem 0.8rem; background: var(--bg-2);
  display: flex; flex-direction: column; gap: 0.2rem;
}
.side button.navlink {
  display: flex; align-items: center; gap: 0.7rem; width: 100%; text-align: left;
  padding: 0.7rem 0.9rem; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 0.95rem;
  transition: background .15s, color .15s;
}
.side button.navlink svg { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.side button.navlink:hover { background: rgba(62,168,255,0.06); color: var(--ivory); }
.side button.navlink.active { background: rgba(62,168,255,0.12); color: var(--accent-bright); }
.side .nav-spacer { flex: 1; }

.content { padding: clamp(1.2rem, 3vw, 2.2rem); max-width: 1100px; }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
.page-head h1 em { font-style: italic; color: var(--accent-bright); }
.page-head p { color: var(--muted); margin-top: 0.3rem; max-width: 60ch; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem; box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 1.1rem; }
.card-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.card-head h2 { font-size: 1.1rem; font-weight: 700; }
.card-head .spacer { flex: 1; }

.placeholder {
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  padding: 2.4rem 1.4rem; text-align: center; color: var(--muted); background: rgba(62,168,255,0.03);
}
.placeholder .lock { font-size: 1.6rem; margin-bottom: 0.6rem; }
.placeholder h2 { font-family: var(--serif); color: var(--ivory); font-weight: 600; font-size: 1.3rem; margin-bottom: 0.4rem; }
.phase-tag { display:inline-block; margin-top: 0.9rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.25rem 0.7rem; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.tbl th, table.tbl td { text-align: left; padding: 0.75rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl th { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr.inactive td { opacity: 0.5; }
.cell-actions { display: flex; gap: 0.4rem; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1.2rem;
  background: rgba(2,5,11,0.72); backdrop-filter: blur(4px);
}
.modal { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; padding: 1.8rem; box-shadow: var(--shadow-card); }
.modal h2 { font-family: var(--serif); font-weight: 600; font-size: 1.4rem; margin-bottom: 0.3rem; }
.modal h2 em { font-style: italic; color: var(--accent-bright); }
.modal p.sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 1.2rem; }

/* one-time password reveal */
.temp-reveal { display: flex; align-items: center; gap: 0.6rem; background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 10px; padding: 0.7rem 0.9rem; margin: 0.6rem 0 0.2rem; }
.temp-reveal code { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.04em; color: var(--accent-bright); flex: 1; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.toast { background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ivory); padding: 0.7rem 1.1rem; border-radius: 999px; font-size: 0.9rem; box-shadow: var(--shadow-card); animation: toastin .2s var(--ease); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .app-layout { grid-template-columns: 1fr; }
  .side {
    flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line);
    position: sticky; top: 61px; z-index: 15; padding: 0.6rem;
  }
  .side button.navlink { width: auto; white-space: nowrap; }
  .side .nav-spacer { display: none; }
  .who .who-name { display: none; }
}
