
:root {
  --bg: #090a0f;
  --surface: #12141c;
  --surface2: #191c26;
  --surface3: #222632;
  --line: #2b303d;
  --line-light: #3d4455;
  --text: #f5f7fb;
  --muted: #9da4b5;
  --cyan: #35d0ff;
  --pink: #ff4f8d;
  --yellow: #ffd43b;
  --green: #51d995;
  --red: #ff6575;
  --radius: 12px;
  --radius-sm: 8px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
button:disabled { opacity: .4; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }

/* SHELL LAYOUT */
.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}
.side {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  gap: 10px;
  padding: 0 8px;
  align-items: center;
  font-weight: 800;
  letter-spacing: .06em;
  font-size: 19px;
}
.mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--cyan), var(--pink) 58%, var(--yellow));
  color: #081016;
  font-weight: 900;
}
.brand small {
  font-size: 9px;
  letter-spacing: .7px;
  font-weight: 500;
  display: block;
  color: var(--muted);
  text-transform: uppercase;
}
.caption {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.5px;
  margin: 0 10px 10px;
  text-transform: uppercase;
}
.nav {
  display: grid;
  gap: 4px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: all .15s ease;
}
.nav a:hover {
  background: var(--surface2);
  color: var(--text);
}
.nav a.active {
  background: #102a34;
  color: var(--cyan);
  font-weight: 600;
}
.nav i {
  display: inline-block;
  width: 18px;
  color: var(--cyan);
  font-style: normal;
  text-align: center;
  font-size: 14px;
}
.nav b {
  margin-left: auto;
  color: var(--cyan);
  font-size: 10px;
  padding: 2px 7px;
  background: #163744;
  border-radius: 10px;
  font-weight: 700;
}
.nav b.alert {
  background: rgba(255, 101, 117, 0.2);
  color: var(--red);
}
.side-bottom {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 16px 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: #102d37;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
}
.side-bottom small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

/* TOP BAR */
.top {
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.crumb {
  font-size: 12px;
  color: var(--muted);
}
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--cyan); }
.crumb span { margin: 0 8px; color: var(--muted); }
.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.role-select-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.role, input, select, textarea {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  outline: none;
  color-scheme: dark;
}
.role:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
}

/* MAIN CONTENT */
.main {
  padding: 24px 28px;
  max-width: 1530px;
  margin: 0 auto;
  width: 100%;
}
.notice-bar {
  background: #132731;
  border: 1px solid #236178;
  color: var(--text);
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--cyan);
  font-weight: 600;
}
h1 { font-size: 28px; letter-spacing: -.5px; margin: 4px 0; font-weight: 800; }
h2 { font-size: 16px; margin: 0; font-weight: 700; }
h3 { font-size: 14px; margin: 0; font-weight: 700; }
p { margin: 4px 0; color: var(--muted); font-size: 12px; }

.button {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s ease;
}
.button:hover { border-color: var(--cyan); }
.button.primary {
  color: #061017;
  background: var(--cyan);
  border-color: var(--cyan);
}
.button.primary:hover { background: #5ce0ff; }
.button.danger {
  color: var(--red);
  border-color: rgba(255, 101, 117, 0.4);
}
.button.danger:hover { background: rgba(255, 101, 117, 0.1); }
.button.sm { padding: 5px 10px; font-size: 11px; }

/* METRICS */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.metric {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.metric label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.metric strong { font-size: 26px; display: block; margin: 4px 0; font-weight: 800; }
.metric small { font-size: 11px; color: var(--muted); }
.metric.cyan strong { color: var(--cyan); }
.metric.yellow strong { color: var(--yellow); }
.metric.green strong { color: var(--green); }
.metric.red strong { color: var(--red); }

/* PANELS & TABLES */
.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 20px;
}
.head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.table-scroll { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}
th {
  padding: 10px 16px;
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 5px;
  padding: 3px 8px;
  background: var(--surface2);
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.pill.green { background: rgba(81, 217, 149, 0.15); color: var(--green); }
.pill.yellow { background: rgba(255, 212, 59, 0.15); color: var(--yellow); }
.pill.red { background: rgba(255, 101, 117, 0.15); color: var(--red); }
.pill.cyan { background: rgba(53, 208, 255, 0.15); color: var(--cyan); }

/* KANBAN BOARD FOR LEADS */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
}
.kanban-col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kanban-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.kanban-card {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all .15s ease;
}
.kanban-card:hover {
  border-color: var(--cyan);
  transform: translateY(-1px);
}
.kanban-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.kanban-card h4 {
  font-size: 13px;
  margin: 0;
  font-weight: 700;
  color: var(--text);
}
.kanban-card p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}
.kanban-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 4px;
}

/* ORDER DRAWER & TABS */
.order-header {
  margin-bottom: 20px;
}
.order-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  overflow-x: auto;
}
.order-tab {
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all .15s ease;
  white-space: nowrap;
}
.order-tab:hover { color: var(--text); }
.order-tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.order-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
}
.gate-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}
.gate {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--line);
  font-size: 12px;
}
.gate.ok { border-color: rgba(81, 217, 149, 0.4); }
.gate-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: var(--surface3);
  color: var(--muted);
}
.gate.ok .gate-icon {
  background: rgba(81, 217, 149, 0.2);
  color: var(--green);
}
.gate-text { flex: 1; }
.gate-text small { display: block; color: var(--muted); font-size: 10px; }

.next-action-card {
  background: linear-gradient(180deg, #102a34 0%, var(--surface) 100%);
  border: 1px solid #236178;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* PROGRESS BAR */
.progress-bar-bg {
  height: 6px;
  background: var(--surface3);
  border-radius: 10px;
  overflow: hidden;
  margin: 6px 0;
}
.progress-bar-fill {
  height: 100%;
  background: var(--cyan);
  border-radius: 10px;
  transition: width .3s ease;
}

/* MODAL & DIALOG */
dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  max-width: 640px;
  width: 92vw;
  margin: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.85);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body { padding: 20px; max-height: 80vh; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface2);
}

.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* TOAST */
#toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  z-index: 1000;
  background: #182c35;
  border: 1px solid #33758b;
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  max-width: 90vw;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  transition: opacity .2s ease;
}
#toast:empty { display: none; }

/* ARTWORK PREVIEW BOX */
.art-box {
  background: #161822;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}
.art-box svg { max-width: 100%; max-height: 280px; }

@media (max-width: 1024px) {
  .shell { grid-template-columns: 80px minmax(0, 1fr); }
  .brand-text, .nav span, .side-bottom span, .caption { display: none; }
  .nav a { justify-content: center; padding: 12px; }
  .nav b { display: none; }
  .order-grid-2 { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: 1fr 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .kanban-board { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
