:root {
  --asw-primary: #153a52;
  --asw-primary-2: #0d2b3d;
  --asw-accent: #20bf6b;
  --asw-accent-dark: #159956;
  --asw-gold: #c8a96a;
  --asw-bg: #f4f7fb;
  --asw-card: #ffffff;
  --asw-text: #183245;
  --asw-muted: #718096;
  --asw-border: #e6ebf1;
  --asw-danger: #e65757;
  --asw-warning: #e6a83c;
  --asw-info: #3a8dd5;
}

html, body { min-height: 100%; }
body {
  background: var(--asw-bg);
  color: var(--asw-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: .94rem;
}
a { color: inherit; }

/* App shell */
.app-shell { min-height: 100vh; }
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 235px;
  background: linear-gradient(180deg, var(--asw-primary-2), #0a2535 70%, #071c29);
  color: rgba(255,255,255,.82);
  z-index: 1040;
  overflow-y: auto;
  transition: transform .25s ease;
  border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand img { width: 48px; height: auto; }
.sidebar-brand .brand-title { font-weight: 700; letter-spacing: .01em; color: #fff; line-height: 1.05; }
.sidebar-brand .brand-sub { font-size: .71rem; color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .14em; margin-top: 4px; }
.sidebar-label { padding: 18px 20px 7px; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.38); font-weight: 700; }
.sidebar-nav { padding: 0 10px 18px; }
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,.72);
  padding: 10px 12px;
  border-radius: 10px;
  margin: 2px 0;
  font-weight: 500;
}
.sidebar-nav .nav-link i { width: 20px; text-align: center; font-size: 1.05rem; }
.sidebar-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar-nav .nav-link.active { color: #fff; background: rgba(32,191,107,.18); box-shadow: inset 3px 0 var(--asw-accent); }
.sidebar-nav .nav-link .pill { margin-left: auto; font-size: .65rem; background: rgba(255,255,255,.11); padding: 2px 7px; border-radius: 999px; }

.app-main { margin-left: 270px; min-height: 100vh; }
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--asw-border);
  min-height: 70px;
}
.app-content { padding: 2px 7px 40px; }
.page-title { font-size: 1.55rem; font-weight: 700; margin-bottom: 3px; }
.page-subtitle { color: var(--asw-muted); font-size: .88rem; }

.sidebar-toggle { display: none; }
.global-search { width: min(430px, 38vw); }
.global-search .form-control { background: #f6f8fb; border-color: transparent; }
.global-search .input-group-text { background: #f6f8fb; border-color: transparent; color: #8491a1; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: #e7f7ef; color: var(--asw-accent-dark); display: inline-grid; place-items: center; font-weight: 700; }

/* Cards & metrics */
.card { border: 1px solid var(--asw-border); border-radius: 16px; box-shadow: 0 8px 24px rgba(16,42,67,.045); }
.card-header { background: transparent; border-bottom-color: var(--asw-border); padding: 18px 20px; }
.card-body { padding: 20px; }
.section-title { font-weight: 700; font-size: 1rem; margin: 0; }
.section-kicker { color: var(--asw-muted); font-size: .78rem; }
.metric-card { position: relative; overflow: hidden; min-height: 135px; }
.metric-card .metric-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; }
.metric-card .metric-value { font-size: 1.72rem; font-weight: 750; margin-top: 16px; letter-spacing: -.02em; }
.metric-card .metric-label { color: var(--asw-muted); font-size: .82rem; }
.metric-card .metric-trend { font-size: .72rem; font-weight: 700; }
.metric-accent-green .metric-icon { background: #e7f8ef; color: #16864e; }
.metric-accent-blue .metric-icon { background: #eaf3fc; color: #2b74b7; }
.metric-accent-amber .metric-icon { background: #fff5df; color: #b9780b; }
.metric-accent-red .metric-icon { background: #fdecec; color: #c63d3d; }

/* Buttons */
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--asw-primary); border-color: var(--asw-primary); }
.btn-primary:hover, .btn-primary:focus { background: #0f3147; border-color: #0f3147; }
.btn-success { background: var(--asw-accent); border-color: var(--asw-accent); }
.btn-success:hover, .btn-success:focus { background: var(--asw-accent-dark); border-color: var(--asw-accent-dark); }
.btn-soft-primary { background: #edf4f8; color: var(--asw-primary); border: 1px solid #dce7ed; }
.btn-soft-success { background: #eaf8f1; color: #147b49; border: 1px solid #d5f0e2; }
.btn-soft-danger { background: #fff0f0; color: #b63a3a; border: 1px solid #f7dede; }

/* Forms */
.form-label { font-size: .78rem; color: #526473; font-weight: 650; margin-bottom: 6px; }
.form-control, .form-select, .input-group-text { min-height: 42px; border-radius: 9px; border-color: #dce3ea; }
.form-control:focus, .form-select:focus { border-color: rgba(32,191,107,.65); box-shadow: 0 0 0 .2rem rgba(32,191,107,.12); }
.form-control::placeholder { color: #a6b0bc; }
.form-text { font-size: .72rem; }
.required::after { content: " *"; color: var(--asw-danger); }
.form-section { padding: 4px 0 2px; }
.form-section + .form-section { border-top: 1px solid var(--asw-border); margin-top: 8px; padding-top: 22px; }
.form-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.form-section-icon { width: 34px; height: 34px; border-radius: 10px; background: #eef7f3; color: var(--asw-accent-dark); display: grid; place-items: center; }

/* Tables */
.table { margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 13px 14px; border-bottom-color: #eef1f4; vertical-align: middle; }
.table thead th { color: #768495; font-size: .69rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 750; background: #fafbfd; border-bottom-width: 1px; white-space: nowrap; }
.table tbody td { font-size: .84rem; }
.table-hover > tbody > tr:hover > * { --bs-table-accent-bg: #fbfdfc; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; font-size: .71rem; font-weight: 700; padding: 5px 9px; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pending { background: #fff4dc; color: #9a6507; }
.status-process { background: #e8f2ff; color: #286ead; }
.status-finished { background: #e8f8f0; color: #167847; }
.status-overdue { background: #ffebeb; color: #b73939; }
.status-draft { background: #eef1f4; color: #66727e; }
.status-approved { background: #e9f6fa; color: #28738c; }

/* Utility UI */
.filter-bar { background: #fff; border: 1px solid var(--asw-border); border-radius: 14px; padding: 14px; }
.quick-action { border: 1px solid var(--asw-border); border-radius: 12px; padding: 14px; display: flex; align-items: center; gap: 12px; text-decoration: none; transition: .18s ease; background: #fff; }
.quick-action:hover { border-color: #c9d7df; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(20,47,67,.06); }
.quick-action .icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: #edf7f2; color: #158b51; }
.list-avatar { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #edf2f6; color: #486272; font-weight: 700; }
.empty-illustration { width: 84px; height: 84px; border-radius: 24px; background: #eef7f3; color: var(--asw-accent-dark); display: grid; place-items: center; margin: auto; font-size: 2rem; }

.progress-thin { height: 7px; border-radius: 999px; background: #edf1f4; }
.progress-thin .progress-bar { border-radius: 999px; }

/* Repair order */
.order-summary { position: sticky; top: 94px; }
.summary-line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #e5e9ee; font-size: .82rem; }
.summary-line:last-child { border-bottom: 0; }
.summary-line span:first-child { color: var(--asw-muted); }
.photo-drop { min-height: 160px; border: 1.5px dashed #cfd8e1; border-radius: 14px; background: #fafcfd; display: grid; place-items: center; text-align: center; color: var(--asw-muted); padding: 18px; }
.photo-drop i { font-size: 1.7rem; color: var(--asw-accent-dark); }
.problem-chip { display: inline-flex; gap: 6px; align-items: center; background: #eef4f7; border: 1px solid #dce6eb; color: #344e5e; border-radius: 999px; padding: 5px 9px; font-size: .74rem; margin: 3px; }
.service-choice input { position: absolute; opacity: 0; pointer-events: none; }
.service-choice label { cursor: pointer; display: block; border: 1px solid #dce3ea; border-radius: 12px; padding: 14px; height: 100%; background: #fff; }
.service-choice input:checked + label { border-color: var(--asw-accent); box-shadow: 0 0 0 3px rgba(32,191,107,.10); background: #fbfffd; }
.sticky-actions { position: sticky; bottom: 0; z-index: 1020; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--asw-border); padding: 12px 0; margin-top: 24px; }

/* Pipeline */
.pipeline-step { position: relative; padding-left: 38px; padding-bottom: 26px; }
.pipeline-step:last-child { padding-bottom: 0; }
.pipeline-step::before { content: ""; position: absolute; left: 14px; top: 25px; bottom: -2px; width: 2px; background: #e4eaee; }
.pipeline-step:last-child::before { display: none; }
.pipeline-dot { position: absolute; left: 3px; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #e8eef2; color: #6e8190; font-size: .7rem; }
.pipeline-step.done .pipeline-dot { background: var(--asw-accent); color: #fff; }
.pipeline-step.current .pipeline-dot { background: var(--asw-primary); color: #fff; box-shadow: 0 0 0 5px #eaf0f4; }

/* Login */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #e8f3ef 0%, #f5f8fb 45%, #edf3f7 100%); }
.login-panel { border: 0; box-shadow: 0 24px 70px rgba(12,43,61,.12); border-radius: 22px; overflow: hidden; }
.login-aside { background: linear-gradient(145deg, #0d2d41, #153f58); color: #fff; padding: 52px; min-height: 560px; position: relative; overflow: hidden; }
.login-aside::after { content: ""; position: absolute; width: 340px; height: 340px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; right: -110px; bottom: -140px; box-shadow: 0 0 0 60px rgba(255,255,255,.025), 0 0 0 120px rgba(255,255,255,.018); }
.login-feature { display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; }
.login-feature .icon { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; background: rgba(32,191,107,.16); color: #6ce3a5; display: grid; place-items: center; }

/* Reports */
.report-number { font-weight: 750; font-size: 1.22rem; }
.spark-bars { height: 68px; display: flex; align-items: flex-end; gap: 5px; }
.spark-bars span { flex: 1; background: #d9e6ed; border-radius: 5px 5px 2px 2px; min-width: 5px; }
.spark-bars span.accent { background: #7fd7a8; }

/* Settings */
.settings-nav .list-group-item { border: 0; border-radius: 9px !important; margin-bottom: 3px; color: #607382; }
.settings-nav .list-group-item.active { background: #edf7f2; color: #117647; font-weight: 700; }
.permission-cell { min-width: 72px; text-align: center; }

@media (max-width: 1199.98px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: 10px 0 40px rgba(0,0,0,.16); }
  .app-sidebar.show { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; }
  .global-search { width: min(360px, 44vw); }
  .order-summary { position: static; }
}

@media (max-width: 767.98px) {
  .app-content { padding: 18px 14px 32px; }
  .app-topbar { min-height: 62px; }
  .global-search { display: none; }
  .page-title { font-size: 1.3rem; }
  .card-body { padding: 16px; }
  .card-header { padding: 15px 16px; }
  .filter-bar { padding: 12px; }
  .hide-mobile { display: none !important; }
  .sticky-actions .btn { padding-left: 12px; padding-right: 12px; }
  .login-aside { min-height: auto; padding: 36px 28px; }
}

/* Desktop sidebar collapse */
@media (min-width: 1200px) {
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .app-sidebar,
  .app-main {
    transition: width .25s ease, margin-left .25s ease;
  }

  body.sidebar-collapsed .app-sidebar {
    width: 82px;
    overflow-x: hidden;
  }

  body.sidebar-collapsed .app-main {
    margin-left: 82px;
  }

  body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
  }

  body.sidebar-collapsed .sidebar-brand img {
    width: 42px;
  }

  body.sidebar-collapsed .sidebar-brand > div,
  body.sidebar-collapsed .sidebar-label,
  body.sidebar-collapsed .sidebar-nav .nav-link > span {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-nav {
    padding-left: 10px;
    padding-right: 10px;
  }

  body.sidebar-collapsed .sidebar-nav .nav-link {
    justify-content: center;
    gap: 0;
    min-height: 44px;
    padding-left: 10px;
    padding-right: 10px;
  }

  body.sidebar-collapsed .sidebar-nav .nav-link i {
    width: auto;
    font-size: 1.15rem;
  }

  body.sidebar-collapsed .sidebar-nav .nav-link.active {
    box-shadow: inset 3px 0 var(--asw-accent);
  }
}

.sticky-horizontal-scroll {
    position: fixed;
    bottom: 10px;
    left: 294px; /* adjust based on sidebar width */
    right: 30px;
    height: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 999;
    display: none;
}

.sticky-horizontal-scroll-inner {
    height: 1px;
}

.compact-form .form-label {
    margin-bottom: 3px;
    font-size: 13px;
}

.compact-form .form-control,
.compact-form .form-select {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 13px;
}

.compact-form textarea.form-control {
    min-height: 60px;
}

.compact-form .row {
    --bs-gutter-y: 8px;
}

.compact-form .mb-3 {
    margin-bottom: 8px !important;
}

.compact-form .card-body {
    padding: 12px 15px;
}