/* Sobisco Ops - Ascent design system
   Palette: white/light bg, dark text, Sobisco red accent (brand e30414).
   Inter, regular weight by default; 600 for headings/buttons. 0.5px borders. */

:root {
  --brand: #e30414;
  --brand-dark: #c20312;
  --ink: #1a1a1a;
  --grey: #6b7280;
  --grey-light: #9ca3af;
  --line: #e2e4e8;
  --bg: #f4f5f7;
  --card: #ffffff;
  --danger: #d64545;
  --ok: #157347;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; margin: 0; }
.muted { color: var(--grey); }
.req { color: var(--danger); font-weight: 400; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; font-size: 14px; font-weight: 500; line-height: 1;
  border: 0.5px solid var(--line); border-radius: 6px; background: var(--card);
  color: var(--ink); cursor: pointer; transition: background .15s, border-color .15s;
}
.btn:hover { background: #f7f8fa; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { background: transparent; }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.inline-form { display: inline; }

.link { color: var(--brand); background: none; border: 0; padding: 0; font-size: 13px; cursor: pointer; font-family: inherit; }
.link-danger { color: var(--danger); }

/* ------------------------------------------------------------------ flash */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; border: 0.5px solid transparent; }
.flash-ok { background: #ecfdf3; color: var(--ok); border-color: #abefc6; }
.flash-error { background: #fef3f2; color: var(--danger); border-color: #fecdca; }

/* ================================================= PUBLIC (forms) ======= */
.public-wrap { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; }
.public-head { display: flex; justify-content: center; padding: 12px 0 24px; }
.brand-logo { height: 36px; display: block; }
.brand-logo-lg { height: 48px; display: block; }
.public-main { }
.public-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 24px; padding-top: 16px; border-top: 0.5px solid var(--line);
}
.ascent-badge img { display: block; }

.form-card, .card {
  background: var(--card); border: 0.5px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px;
}
.form-title { font-size: 22px; margin-bottom: 8px; }
.form-intro { color: var(--grey); font-size: 13.5px; margin: 0 0 24px; line-height: 1.6; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.grid-3 .field { margin-bottom: 0; }
.field-full { grid-column: 1 / -1; }
label { font-size: 13px; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=tel], select, textarea {
  width: 100%; padding: 9px 11px; font-family: inherit; font-size: 14px; color: var(--ink);
  background: #fff; border: 0.5px solid var(--line); border-radius: 6px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(227,4,20,.1); }
textarea { resize: vertical; }
input[type=file] { font-size: 13px; padding: 8px; border: 0.5px dashed var(--line); border-radius: 6px; width: 100%; background: #fafbfc; }
small.err { color: var(--danger); font-size: 12px; }

/* ------------------------------------------------------- CV dropzone */
.uploader { position: relative; }
.uploader input[type=file] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.dropzone {
  display: flex; align-items: center; gap: 14px;
  border: 1.5px dashed #d6dae0; border-radius: var(--radius); background: #fafbfc;
  padding: 18px 18px; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--brand); background: #fff; }
.dropzone.is-drag { border-color: var(--brand); background: rgba(227,4,20,.04); border-style: solid; }
.dropzone.has-file { border-style: solid; border-color: #cbd0d6; background: #fff; }
.dz-icon { flex-shrink: 0; width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: rgba(227,4,20,.08); color: var(--brand); }
.dropzone.has-file .dz-icon { background: #ecfdf3; color: var(--ok); }
.dz-body { min-width: 0; flex: 1; }
.dz-title { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.dz-title b { color: var(--brand); font-weight: 600; }
.dz-sub { font-size: 12px; color: var(--grey); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-btn {
  flex-shrink: 0; font-size: 13px; font-weight: 500; padding: 8px 14px; border-radius: 6px;
  border: 0.5px solid var(--line); background: #fff; color: var(--ink);
}
.dropzone:hover .dz-btn { border-color: var(--brand); color: var(--brand); }
.dz-clear { flex-shrink: 0; border: 0; background: none; color: var(--grey); cursor: pointer; font-size: 13px; padding: 6px 8px; font-family: inherit; display: none; }
.dropzone.has-file .dz-clear { display: inline-block; }
.dropzone.has-file .dz-btn { display: none; }
@media (max-width: 768px) {
  .dropzone { flex-wrap: wrap; }
  .dz-btn, .dz-clear { width: 100%; text-align: center; }
}
small.hint { font-size: 12px; }

.fieldset { margin-bottom: 20px; }
.fs-label { display: block; font-size: 13px; margin-bottom: 10px; }
.check-row { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: center; }
.check-col { display: flex; flex-direction: column; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check input { width: auto; }
.check-other span { white-space: nowrap; }
.check-other input { width: auto; min-width: 160px; padding: 6px 9px; }

.form-actions { margin-top: 8px; display: flex; gap: 10px; }

/* ------------------------------------------------------- centred cards */
.center-card { max-width: 440px; margin: 40px auto; text-align: center; }
.login-card { max-width: 380px; margin: 32px auto; }
.login-brand { display: flex; justify-content: center; margin-bottom: 16px; }
.login-title { text-align: center; font-size: 18px; margin-bottom: 20px; }
.tick { display: flex; justify-content: center; margin-bottom: 12px; }
.ty-title { font-size: 20px; margin-bottom: 8px; }
.ty-msg { margin-bottom: 20px; }
.nf-code { font-size: 48px; color: var(--brand); margin-bottom: 8px; }

/* ==================================================== ADMIN SHELL ======= */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex-shrink: 0; background: #fff; border-right: 0.5px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; }
.sidebar-brand { display: block; }
.sidebar-brand:hover { text-decoration: none; }
.nav-close { display: none; font-size: 24px; line-height: 1; color: var(--grey); cursor: pointer; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px;
  color: var(--ink); font-size: 14px; transition: background .12s;
}
.sidebar-nav a:hover { background: #f4f5f7; text-decoration: none; }
.sidebar-nav a.active { background: rgba(227,4,20,.08); color: var(--brand); font-weight: 500; }
.sidebar-nav a svg { flex-shrink: 0; }

.sidebar-foot { padding: 14px 16px; border-top: 0.5px solid var(--line); }
.sidebar-user { display: flex; flex-direction: column; margin-bottom: 10px; }
.su-name { font-size: 13px; font-weight: 500; }
.su-role { font-size: 12px; }
.btn-logout {
  display: block; text-align: center; font-size: 13px; padding: 7px; border: 0.5px solid var(--line);
  border-radius: 6px; color: var(--ink); margin-bottom: 14px;
}
.btn-logout:hover { background: #f4f5f7; text-decoration: none; }
.sidebar-ascent { padding-top: 12px; border-top: 0.5px solid var(--line); }
.sidebar-ascent img { display: block; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.main { padding: 24px 28px 40px; max-width: 1160px; width: 100%; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* --------------------------------------------------------------- stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border: 0.5px solid var(--line); border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); color: var(--ink);
}
.stat-card:hover { text-decoration: none; border-color: var(--brand); }
.stat-label { font-size: 13px; color: var(--grey); }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1.1; }
.stat-sub { font-size: 12px; }

/* --------------------------------------------------------------- panels */
.panel { background: #fff; border: 0.5px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 0.5px solid var(--line); }
.panel-head h2 { font-size: 15px; }
.mini-list { display: flex; flex-direction: column; }
.mini-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 0.5px solid var(--line); color: var(--ink); }
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { background: #f7f8fa; text-decoration: none; }
.mr-name { font-size: 13.5px; font-weight: 500; }
.mr-meta, .mr-date { font-size: 12.5px; }
.pad { padding: 16px 18px; }

/* -------------------------------------------------------------- toolbar */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.search-input { max-width: 320px; }
.count { font-size: 13px; margin-left: auto; }

/* ---------------------------------------------------------------- table */
.table-wrap { background: #fff; border: 0.5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead th {
  text-align: left; font-weight: 500; color: var(--grey); font-size: 12px; text-transform: uppercase;
  letter-spacing: .03em; padding: 11px 16px; border-bottom: 0.5px solid var(--line); background: #fafbfc;
}
.data-table tbody td { padding: 12px 16px; border-bottom: 0.5px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr[data-href] { cursor: pointer; }
.data-table tbody tr:hover { background: #f7f8fa; }
.cell-link { font-weight: 500; }
.row-actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 500; border: 0.5px solid var(--line); }
.badge-master { background: rgba(227,4,20,.08); color: var(--brand); border-color: rgba(227,4,20,.2); }
.badge-distributor { background: #fff7ed; color: #b45309; border-color: #fed7aa; }
.badge-member { background: #f0fdf4; color: var(--ok); border-color: #bbf7d0; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-on { background: var(--ok); }
.dot-off { background: var(--grey-light); }

/* ---------------------------------------------------------- detail view */
.detail-card { background: #fff; border: 0.5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 24px; }
.form-narrow { max-width: 520px; padding: 24px; }
.detail-list { margin: 0; }
.detail-row { display: grid; grid-template-columns: 200px 1fr; gap: 16px; padding: 12px 0; border-bottom: 0.5px solid var(--line); }
.detail-row:last-child { border-bottom: 0; }
.detail-row dt { color: var(--grey); font-size: 13px; margin: 0; }
.detail-row dd { margin: 0; font-size: 14px; color: var(--ink); word-break: break-word; }

.empty-state { background: #fff; border: 0.5px solid var(--line); border-radius: var(--radius); padding: 40px; text-align: center; box-shadow: var(--shadow); }
.empty-state h2 { font-size: 18px; margin-bottom: 8px; }

/* ------------------------------------------------ mobile drawer toggle */
.nav-open, .nav-close { -webkit-tap-highlight-color: transparent; }
.nav-backdrop { display: none; }

/* ===================================================== RESPONSIVE ======= */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  .form-card, .card { padding: 20px; }

  /* Sidebar becomes an off-canvas drawer. */
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 40; height: 100vh; width: 260px;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.12);
  }
  #nav-toggle:checked ~ .app .sidebar { transform: translateX(0); }
  .nav-close { display: block; }
  #nav-toggle:checked ~ .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }

  .topbar {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #fff;
    border-bottom: 0.5px solid var(--line); position: sticky; top: 0; z-index: 20;
  }
  .nav-open { display: inline-flex; color: var(--ink); cursor: pointer; }
  .topbar-title { font-size: 15px; font-weight: 600; }
  .main { padding: 16px; }
  .page-head h1 { font-size: 18px; }

  /* Tables reflow into vertical cards. */
  .table-wrap { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    background: #fff; border: 0.5px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 12px; padding: 6px 14px;
  }
  .data-table tbody td { border: 0; border-bottom: 0.5px solid var(--line); padding: 9px 0; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
  .data-table tbody tr td:last-child { border-bottom: 0; }
  .data-table tbody td::before {
    content: attr(data-label); color: var(--grey); font-size: 12px; text-transform: uppercase;
    letter-spacing: .03em; flex-shrink: 0; font-weight: 500;
  }
  .data-table tbody td[data-label=""]::before { content: ""; }
  .cell-link { text-align: right; }
  .row-actions { justify-content: flex-end; }

  .detail-row { grid-template-columns: 1fr; gap: 4px; }
  .detail-row dt { font-size: 12px; }

  .search-input { max-width: none; flex: 1; }
  .public-foot { flex-direction: column-reverse; gap: 16px; text-align: center; }
}
