:root {
  --navy: #0b1636;
  --navy-2: #101f46;
  --ink: #17213a;
  --muted: #6f7893;
  --line: #e6eaf2;
  --canvas: #f4f7fb;
  --surface: #ffffff;
  --teal: #18bfa8;
  --teal-dark: #0b927f;
  --blue: #2563eb;
  --amber: #f59e0b;
  --red: #e54861;
  --violet: #7c3aed;
  --shadow: 0 20px 60px rgba(16, 31, 70, .10);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font: 14px/1.45 "Segoe UI", Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow {
  display: block;
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 18px;
}
.brand img { width: 38px; height: 38px; }
.brand b { color: #3de0c9; }
.brand small { display: block; margin-top: -4px; color: #93a3c5; font-size: 11px; font-weight: 600; }
.brand-large { font-size: 21px; }

.login-screen, .setup-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: #fff;
}
.setup-screen {
  grid-template-columns: 1fr;
  place-items: center;
  background:
    radial-gradient(circle at 15% 85%, rgba(24, 191, 168, .16), transparent 28%),
    radial-gradient(circle at 90% 20%, rgba(37, 99, 235, .16), transparent 32%),
    var(--canvas);
}
.login-brand-panel {
  position: relative;
  overflow: hidden;
  padding: 42px 48px;
  color: #fff;
  background:
    radial-gradient(circle at 15% 85%, rgba(24, 191, 168, .35), transparent 28%),
    radial-gradient(circle at 90% 20%, rgba(37, 99, 235, .35), transparent 32%),
    var(--navy);
}
.login-brand-panel::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -140px;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  box-shadow: 0 0 0 56px rgba(255,255,255,.03), 0 0 0 112px rgba(255,255,255,.02);
}
.login-copy {
  position: relative;
  z-index: 1;
  max-width: 610px;
  margin-top: clamp(80px, 18vh, 180px);
}
.login-copy .eyebrow { color: #45e3cc; }
.login-copy h1 {
  margin: 12px 0 18px;
  font-size: clamp(40px, 5vw, 68px);
  line-height: 1.06;
  letter-spacing: -2.3px;
}
.login-copy p { max-width: 560px; color: #c9d4eb; font-size: 16px; }
.check-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  color: #eff5ff;
  font-weight: 700;
  font-size: 13px;
}
.check-line span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(24, 191, 168, .15);
}
.login-card {
  width: min(410px, calc(100% - 44px));
  margin: auto;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}
.login-card h2 { margin: 12px 0 6px; font-size: 28px; }
.login-card p { margin: 0 0 25px; color: var(--muted); }
.login-card small { display: block; margin-top: 16px; color: #9aa5bb; text-align: center; }
.login-error {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  color: #b42338;
  background: #fff0f3;
  font-size: 12px;
}

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 270px;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 18px;
  color: #fff;
  background:
    radial-gradient(circle at 10% 90%, rgba(24, 191, 168, .20), transparent 32%),
    var(--navy);
}
.main-nav { flex: 1; margin-top: 34px; }
.nav-label {
  margin: 24px 12px 10px;
  color: #7886a5;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  padding: 12px 13px;
  color: #b8c4dd;
  border: 0;
  border-radius: 13px;
  background: transparent;
  text-align: left;
  font-weight: 700;
  transition: .18s ease;
}
.nav-item:hover, .nav-item.active {
  color: #fff;
  background: rgba(255,255,255,.08);
}
.nav-item span { width: 20px; color: #39d8c2; text-align: center; }
.nav-item b {
  margin-left: auto;
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #35dec7;
  background: rgba(24, 191, 168, .15);
  font-size: 11px;
  text-align: center;
}
.sidebar-user {
  display: grid;
  grid-template-columns: 42px 1fr 38px;
  align-items: center;
  gap: 11px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.10);
}
.sidebar-user strong,
.sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { color: #9ba9c6; font-size: 11px; }

.main {
  width: calc(100% - 270px);
  margin-left: 270px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
}
.topbar-title { min-width: 160px; }
.topbar-title strong { display: block; margin-top: 2px; font-size: 18px; }
.global-search {
  flex: 1;
  max-width: 620px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: #9aa4ba;
}
.global-search input {
  flex: 1;
  min-width: 140px;
  padding: 10px 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}
.demo-role {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}
.content {
  max-width: 1500px;
  margin: auto;
  padding: 30px 32px 54px;
}

.primary-button, .secondary-button, .ghost-button, .icon-button {
  border: 0;
  border-radius: 12px;
  font-weight: 800;
  transition: .18s ease;
}
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), #14a994);
  box-shadow: 0 12px 28px rgba(24, 191, 168, .22);
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 15px 34px rgba(24, 191, 168, .30); }
.secondary-button {
  min-height: 42px;
  padding: 0 16px;
  color: #526079;
  border: 1px solid #dbe1eb;
  background: #fff;
}
.ghost-button {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  color: var(--teal-dark);
  background: #e9fbf8;
}
.icon-button {
  width: 40px;
  height: 40px;
  color: #73809b;
  background: transparent;
  font-size: 20px;
}
.icon-button:hover { color: var(--ink); background: #eef2f7; }
.mobile-menu { display: none; }

.field {
  display: grid;
  gap: 7px;
  color: #42506a;
  font-size: 12px;
  font-weight: 800;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #dce3ef;
  border-radius: 12px;
  outline: 0;
  color: var(--ink);
  background: #fbfcfe;
  font-weight: 500;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(24, 191, 168, .12);
}
.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 12px 14px;
  border: 1px solid #dce3ef;
  border-radius: 14px;
  background: #f7fbff;
  color: var(--ink);
}
.check-field input { width: auto; accent-color: var(--teal); }
.product-sale-fields {
  padding: 16px;
  border: 1px dashed #9edbd2;
  border-radius: 16px;
  background: #f2fffc;
}
.product-sale-fields .panel-head { margin-bottom: 12px; }
.product-grid { margin-top: 0; }
.product-summary {
  display: grid;
  gap: 10px;
}
.product-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d8f2ed;
  border-radius: 14px;
  background: #f7fffd;
}
.product-item strong, .product-item small { display: block; }
.product-item small { color: var(--muted); }
.product-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #075f54;
  background: #e3fbf6;
  font-weight: 900;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.photo-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dce3ef;
  border-radius: 16px;
  color: inherit;
  background: #fbfcfe;
}
.photo-card:hover {
  border-color: #9edbd2;
  box-shadow: 0 14px 32px rgba(9, 25, 57, .08);
}
.photo-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 12px;
  background: #eef2f7;
}
.photo-card span {
  font-weight: 900;
  color: var(--ink);
}
.photo-card small {
  color: var(--muted);
  line-height: 1.35;
}
.photo-upload {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed #9edbd2;
  border-radius: 16px;
  background: #f7fffd;
}
.helper-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 22px;
}
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -.7px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: #4d5b73;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.metric-card {
  position: relative;
  overflow: hidden;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 32px rgba(16, 31, 70, .06);
}
.metric-card::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 98px;
  height: 98px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--metric), white 82%);
}
.metric-card span { color: var(--muted); font-weight: 700; font-size: 12px; }
.metric-card strong { display: block; margin-top: 12px; font-size: 32px; }
.metric-card small { color: var(--muted); }
.metric-teal { --metric: var(--teal); }
.metric-blue { --metric: var(--blue); }
.metric-amber { --metric: var(--amber); }
.metric-violet { --metric: var(--violet); }

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .85fr);
  gap: 20px;
}
.panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 32px rgba(16, 31, 70, .06);
}
.panel + .panel { margin-top: 18px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.service-list { display: grid; gap: 10px; }
.service-row {
  display: grid;
  grid-template-columns: minmax(100px, .75fr) minmax(190px, 1.4fr) minmax(150px, 1fr) minmax(140px, .9fr) 96px 116px;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid #edf1f6;
  border-radius: 14px;
  background: #fff;
  transition: .18s ease;
}
.service-row:hover { transform: translateY(-1px); border-color: #cceee9; box-shadow: 0 10px 24px rgba(16, 31, 70, .06); }
.service-row strong, .service-row small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-row small { color: var(--muted); font-size: 11px; }
.order-code { color: var(--teal-dark); font-weight: 900; }
.person {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #4f5d75;
  font-weight: 700;
}
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  font-size: 12px;
  font-weight: 900;
}
.avatar.small { width: 30px; height: 30px; border-radius: 9px; font-size: 10px; }
.status, .priority, .role-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pending { color: #a56700; background: #fff7df; }
.status-progress { color: #1d5fd0; background: #eaf2ff; }
.status-review { color: #6651dd; background: #f0edff; }
.status-done { color: #087c6b; background: #e7fbf7; }
.priority-high { color: #b42338; background: #fff0f3; }
.priority-medium { color: #a56700; background: #fff7df; }
.priority-low { color: #087c6b; background: #e7fbf7; }
.role-pill.pending { color: #8a4b00; background: #fff4d8; }

.filter-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 190px 170px 170px;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.filter-bar input, .filter-bar select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #dce3ef;
  border-radius: 12px;
  outline: 0;
  color: var(--ink);
  background: #fbfcfe;
}

.table-wrap {
  overflow-x: auto;
  padding: 0;
}
.services-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}
.services-table th {
  padding: 14px 16px;
  color: #8190aa;
  background: #fafbfe;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  text-align: left;
}
.services-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f3f8;
  font-size: 13px;
}
.services-table tbody tr { cursor: pointer; }
.services-table tbody tr:hover { background: #fbfdff; }
.empty {
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}
.empty.compact { padding: 24px 16px; }

.team-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.team-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.team-card.pending-card {
  border-color: #ffe1a3;
  background: linear-gradient(180deg, #fffaf0, #fff);
}
.team-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.team-top h3 { margin: 0; }
.team-top p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.team-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.team-stats div {
  padding: 12px;
  border-radius: 13px;
  background: #f6f8fb;
  color: var(--muted);
  font-size: 12px;
}
.team-stats strong { display: block; color: var(--ink); font-size: 18px; }
.card-note {
  margin: 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.bar-list { display: grid; gap: 12px; }
.bar-item {
  display: grid;
  grid-template-columns: 140px 1fr 44px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.bar-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #eef2f7;
}
.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.settings-list { display: grid; gap: 12px; }
.setting-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid #eef2f7;
  border-radius: 14px;
}
.setting-row code {
  word-break: break-all;
  color: var(--teal-dark);
  font-weight: 800;
}

.modal, .drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 22, 54, .46);
}
.modal-card {
  width: min(820px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px;
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}
.modal-small { width: min(560px, 100%); }
.modal-header, .modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.modal-header h2 { margin: 5px 0 0; }
.modal-footer { margin-top: 22px; justify-content: flex-end; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 22px;
}
.field-full { grid-column: 1 / -1; }

.drawer { place-items: stretch end; padding: 0; }
.drawer-card {
  width: min(560px, 100%);
  height: 100%;
  overflow: auto;
  padding: 26px;
  background: #fff;
  box-shadow: var(--shadow);
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.detail-box {
  padding: 14px;
  border: 1px solid #eef2f7;
  border-radius: 14px;
  background: #fbfcfe;
}
.detail-box small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: 10px;
}
.detail-box strong { display: block; margin-top: 4px; }
.timeline { display: grid; gap: 10px; margin-top: 12px; }
.timeline-item {
  padding: 12px;
  border-left: 3px solid var(--teal);
  border-radius: 12px;
  background: #f6fbfa;
}
.timeline-item p { margin: 0; }
.timeline-item small { color: var(--muted); }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.status-editor {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #dff7f2;
  border-radius: 16px;
  background: #f4fffc;
}
.status-editor .field { margin: 0; }
.note-box {
  width: 100%;
  min-height: 96px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #dce3ef;
  border-radius: 12px;
  outline: 0;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 10px;
}
.toast {
  max-width: 360px;
  padding: 13px 15px;
  border-radius: 14px;
  color: #fff;
  background: var(--navy);
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-two { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: 42vh; padding: 30px; }
  .login-copy { margin-top: 60px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main { width: 100%; margin-left: 0; }
  .mobile-menu { display: inline-grid; place-items: center; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .topbar-title { flex: 1; }
  .global-search { order: 4; width: 100%; max-width: none; }
  .content { padding: 22px 16px 42px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .metrics-grid, .team-grid, .form-grid, .filter-bar, .detail-grid, .status-editor, .photo-grid, .photo-upload { grid-template-columns: 1fr; }
  .service-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
