/* Cybrix Labs — control panel */

:root {
  --ink: #0A1428;
  --ink-700: #14264A;
  --blue: #F5720C;
  --blue-600: #D65E00;
  --cyan: #FF9A47;
  --mist: #F4F6FB;
  --line: #E3E8F4;
  --muted: #6B7897;
  --ok: #17A673;
  --bad: #C22B2B;
  --display: "Space Grotesk", "Segoe UI", sans-serif;
  --body: "DM Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0; font-family: var(--body); background: var(--mist); color: var(--ink-700);
  font-size: .95rem; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--ink); margin: 0 0 .5rem; letter-spacing: -.02em; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- login ---------- */

.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-visual {
  background: var(--ink); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 56px 56px;
}
.login-visual h1 { color: #fff; font-size: 2.4rem; max-width: 14ch; }
.login-visual p { color: rgba(255,255,255,.6); max-width: 42ch; }
.login-form { display: grid; place-items: center; padding: 2rem; }
.login-card { width: min(100%, 380px); }
.login-card .brand { font-family: var(--display); font-weight: 700; font-size: 1.4rem; margin-bottom: 2rem; display: block; color: var(--ink); }

/* ---------- shell ---------- */

.admin { display: grid; grid-template-columns: 262px 1fr; min-height: 100vh; }

.sidebar { background: var(--ink); color: rgba(255,255,255,.66); padding: 1.5rem 0 3rem; }
.sidebar .brand {
  display: flex; align-items: center; gap: .6rem; color: #fff; font-family: var(--display);
  font-weight: 700; font-size: 1.15rem; padding: 0 1.5rem 1.5rem;
}
.sidebar .brand small { display: block; font-family: var(--mono); font-size: .55rem; letter-spacing: .2em; color: var(--cyan); font-weight: 400; }
.side-group { padding: 1.25rem 1.5rem .4rem; font-family: var(--mono); font-size: .64rem; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.35); }
.sidebar nav a {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .62rem 1.5rem; font-size: .92rem; border-left: 2px solid transparent; transition: background .2s, color .2s, border-color .2s;
}
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar nav a.is-active { background: rgba(43,91,255,.16); border-left-color: var(--cyan); color: #fff; }
.sidebar .pill { background: var(--blue); color: #fff; border-radius: 100px; font-family: var(--mono); font-size: .68rem; padding: .1rem .5rem; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: #fff; border-bottom: 1px solid var(--line); padding: 1rem 1.75rem;
}
.topbar h1 { font-size: 1.3rem; margin: 0; }
.topbar .crumb { font-family: var(--mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: .75rem; }
.content { padding: 1.75rem; flex: 1; }

.burger { display: none; background: none; border: 1px solid var(--line); border-radius: 4px; padding: .45rem .6rem; cursor: pointer; }

/* ---------- cards, tables ---------- */

.card { background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.card + .card { margin-top: 1.25rem; }
.card-head { padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 1.05rem; margin: 0; }
.card-body { padding: 1.35rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1.25rem; }
.stat-card b { display: block; font-family: var(--display); font-size: 2rem; color: var(--ink); }
.stat-card span { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.stat-card:hover { border-color: var(--blue); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding: .85rem 1.35rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: .9rem 1.35rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FAFCFF; }
td .thumb { width: 56px; height: 40px; object-fit: cover; border-radius: 3px; background: var(--mist); }
.row-title { font-weight: 500; color: var(--ink); }
.row-sub { font-size: .82rem; color: var(--muted); }
.actions { display: flex; gap: .4rem; justify-content: flex-end; }

.badge { display: inline-block; font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; padding: .25rem .55rem; border-radius: 3px; }
.badge--ok { background: rgba(23,166,115,.12); color: var(--ok); }
.badge--off { background: rgba(107,120,151,.14); color: var(--muted); }
.badge--new { background: rgba(43,91,255,.12); color: var(--blue); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1rem; border-radius: 4px;
  border: 1px solid transparent; font-size: .88rem; font-weight: 500; cursor: pointer; background: none;
  transition: background .2s, color .2s, border-color .2s;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-600); }
.btn-outline { border-color: var(--line); background: #fff; color: var(--ink); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger { border-color: rgba(194,43,43,.3); color: var(--bad); background: #fff; }
.btn-danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-block { width: 100%; justify-content: center; padding: .8rem 1rem; }
.btn-xs { padding: .35rem .6rem; font-size: .78rem; }

/* ---------- forms ---------- */

.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field label { font-family: var(--mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number],
.field input[type=date], .field input[type=file], .field select, .field textarea {
  width: 100%; font-family: var(--body); font-size: .93rem; padding: .65rem .75rem;
  border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink);
}
.field textarea { min-height: 110px; resize: vertical; }
.field textarea.rich { min-height: 260px; font-family: var(--mono); font-size: .85rem; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(43,91,255,.12); }
.field .help { font-size: .78rem; color: var(--muted); }
.field .err { font-size: .8rem; color: var(--bad); }

.switch { display: flex; align-items: center; gap: .6rem; padding-top: 1.25rem; }
.switch input { width: 18px; height: 18px; accent-color: var(--blue); }
.switch span { font-size: .9rem; }

.preview { margin-top: .5rem; display: flex; align-items: center; gap: .75rem; }
.preview img { width: 110px; height: 74px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.form-foot { display: flex; gap: .6rem; justify-content: flex-end; padding: 1.1rem 1.35rem; border-top: 1px solid var(--line); background: #FAFBFE; }

.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding: 0 1.35rem; }
.tabs a, .tabs button {
  padding: .85rem 1rem; font-size: .9rem; border: 0; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; color: var(--muted);
}
.tabs a.is-active, .tabs button.is-active { color: var(--ink); border-bottom-color: var(--blue); font-weight: 500; }

.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search], .toolbar select {
  padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 4px; font-family: var(--body); font-size: .88rem; background: #fff;
}

.flash { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 1.1rem; border-radius: 4px; margin-bottom: 1.25rem; font-size: .92rem; }
.flash--ok { background: rgba(23,166,115,.1); color: #0F7A54; }
.flash--bad { background: rgba(194,43,43,.1); color: var(--bad); }
.flash button { background: none; border: 0; cursor: pointer; color: inherit; font-size: 1.1rem; line-height: 1; }

.empty { padding: 3rem 1.5rem; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); }

.pagination { display: flex; gap: .3rem; list-style: none; padding: 1.1rem 1.35rem; margin: 0; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 .55rem;
  border: 1px solid var(--line); border-radius: 4px; font-family: var(--mono); font-size: .78rem; background: #fff;
}
.pagination .is-current span { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination .disabled span { opacity: .45; }

.detail-row { display: grid; grid-template-columns: 160px 1fr; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: 0; }
.detail-row dt { font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.detail-row dd { margin: 0; }

/* ---------- column spans ---------- */
.col-1 { grid-column: span 1; } .col-2 { grid-column: span 2; } .col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; } .col-6 { grid-column: span 6; } .col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; } .col-12 { grid-column: span 12; }

@media (max-width: 1024px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .admin.nav-open .sidebar { display: block; }
  .burger { display: inline-flex; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-visual { display: none; }
}

@media (max-width: 760px) {
  .form-grid > [class*="col-"] { grid-column: span 12; }
  .content { padding: 1rem; }
  .topbar { padding: .85rem 1rem; }
}
