/* ===== Knorr Electrical Admin Theme (full file rewrite) =====
   Palette:
     Primary Blue   : #0080C4 (from your swatch)
     Accent Orange  : #FF7A1A
     Surfaces/Border: whites + cool grays
================================================================ */

/* ===== Theme Tokens ===== */
:root {
  /* Brand — Blue scale (derived from #0080C4) */
  --blue-900: #004864;
  /* deep */
  --blue-800: #005a87;
  --blue-700: #006fa9;
  --blue-600: #0080C4;
  /* primary */
  --blue-500: #1990cf;
  --blue-400: #37a2d9;
  --blue-100: #e6f4fb;
  /* soft tint */

  /* Accent — Orange scale */
  --orange-800: #cc5f12;
  --orange-700: #e56c12;
  --orange-600: #FF7A1A;
  /* highlight/accent */
  --orange-100: #fff4ea;

  /* Neutral surface */
  --paper: #ffffff;
  --ink: #111826;
  --muted: #667085;
  --border: #e6e8ee;

  /* Back-compat tokens (replacing all former purples) */
  --navy: var(--blue-900);
  --navy-700: var(--blue-700);
  --sky: var(--blue-100);
  --accent: var(--blue-700);

  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 56, 84, .10);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: #f7f8fc;
}

/* ===== App layout ===== */
.app {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: linear-gradient(180deg, var(--blue-900), var(--blue-800) 65%, #003a50);
  color: #fff;
  display: flex;
  flex-direction: column;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.sidebar__brand img {
  height: 40px;
  width: auto;
  display: block;
}

.sidebar__nav {
  padding: .75rem 0;
}

.nav__item {
  display: block;
  color: #d8ecf6;
  text-decoration: none;
  padding: .75rem 1rem;
  border-left: 3px solid transparent;
}

.nav__item:hover {
  background: rgba(255, 255, 255, .07);
  color: #fff;
}

.nav__item.is-active {
  background: rgba(255, 255, 255, .12);
  border-left-color: #fff;
  color: #fff;
}

.sidebar__footer {
  margin-top: auto;
  padding: 1rem;
  color: #cfe8f4;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

/* ===== Main ===== */
.main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* ===== Topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  padding: .9rem 1.25rem;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.only-mobile {
  display: none;
}

.topbar__title h1 {
  margin: 0;
  font-size: 1.25rem;
}

.topbar__title .subtitle {
  margin: .15rem 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.user__name {
  font-size: .95rem;
  color: var(--blue-700);
}

/* ===== Content container ===== */
.content {
  padding: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ===== Card ===== */
.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.card__head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, #f7fbff);
}

.card__head h2 {
  margin: .25rem 0 .35rem;
}

.card__head p {
  margin: 0;
  color: var(--muted);
}

.card__body {
  padding: 1.25rem;
}

.card.jump-highlight {
  box-shadow: 0 0 0 3px rgba(0, 128, 196, .22);
  transition: box-shadow .6s ease;
}

/* ===== Forms ===== */
.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
}

.form__label {
  grid-column: 1/-1;
  font-weight: 600;
}

.form__control {
  width: 100%;
  padding: .7rem .8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 1rem;
  outline: none;
}

.form__control:focus {
  border-color: var(--blue-700);
  box-shadow: 0 0 0 3px rgba(0, 128, 196, .18);
}

textarea.form__control {
  min-height: 180px;
  grid-column: 1/-1;
  resize: vertical;
}

.form__actions {
  grid-column: 1/-1;
  display: flex;
  gap: .75rem;
  justify-content: flex-start;
  margin-top: .25rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: .65rem 1rem;
  font-weight: 600;
  cursor: pointer;
  background: #f8fafc;
  color: var(--ink);
}

.btn--primary {
  background: var(--blue-600);
  color: #fff;
}

.btn--primary:hover {
  background: var(--blue-700);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: #cfd2ea;
}

/* Accent / callout button (orange) */
.btn--accent {
  background: var(--orange-600);
  color: #fff;
  border-color: var(--orange-600);
}

.btn--accent:hover {
  background: var(--orange-700);
}

/* Small pills (statuses, quick actions) */
.pill {
  display: inline-block;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--sky);
  color: #123a4a;
  border: 1px solid #d9edf7;
}

.pill--warn {
  background: var(--orange-100);
  color: var(--orange-700);
  border-color: #ffd9bd;
}

.pill--ok {
  background: #e8f7ef;
  color: #166534;
  border-color: #c8efd8;
}

.pill--muted {
  background: #f3f4f6;
  color: #4b5563;
  border-color: #e5e7eb;
}

/* ===== Links & Focus ===== */
a {
  color: var(--blue-700);
}

a:hover {
  color: var(--blue-500);
}

/* ===== Processing overlay ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  /* toggled by .is-open */
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: saturate(160%) blur(2px);
}

.loading-overlay.is-open {
  display: flex;
}

.loading-card {
  width: min(520px, 92vw);
  background: #fff;
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

.loading-title {
  margin: 0 0 .25rem;
  font-weight: 700;
  font-size: 18px;
  color: #0f172a;
}

.loading__msg {
  margin: .25rem 0 1rem;
  color: #334155;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--blue-500), var(--blue-700));
  transition: width .35s ease;
}

/* Optional: visually disable form while loading */
.is-busy .form .form__control,
.is-busy .form button {
  pointer-events: none;
  opacity: .6;
}

/* ===== Layout helpers ===== */
.cols {
  display: grid;
  grid-template-columns: 1fr;
  /* mobile stack */
  gap: 1.25rem 2rem;
  align-items: start;
}

@media (min-width: 900px) {
  .cols {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.cols>div {
  min-width: 0;
}

.kv {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: .5rem .75rem;
  align-items: center;
}

@media (max-width: 700px) {
  .kv {
    grid-template-columns: 1fr;
  }

  .kv>div:first-child {
    font-weight: 600;
  }
}

.section-title {
  margin: 0 0 .35rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}

.form__checkbox {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .25rem 0;
}

.note.small {
  font-size: .85rem;
  line-height: 1.35;
  color: #6b7280;
}

/* ===== Settings grid ===== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem 2rem;
  align-items: start;
}

@media (min-width: 980px) {
  .settings-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.settings-grid .col {
  min-width: 0;
}

/* Inputs always fill */
.form__control {
  width: 100%;
  min-height: 38px;
}

/* Prevent long <code> from stretching layout */
code {
  white-space: nowrap;
}

/* Make a child inside .form span both grid columns */
.form .full {
  grid-column: 1 / -1;
}

/* ===== Tint utility for sections ===== */
.section--tint {
  background: linear-gradient(180deg, var(--blue-100), #ffffff);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ===== Responsiveness ===== */
@media (max-width: 980px) {
  .form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .only-mobile {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    left: -270px;
    top: 0;
    bottom: 0;
    transition: left .25s ease;
  }

  .sidebar.is-open {
    left: 0;
  }

  .main {
    margin-left: 0;
  }
}

.money-wrap {
  position: relative;
}

.money-wrap::before {
  content: "$";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: .9rem;
  pointer-events: none;
}

.money-wrap>input {
  padding-left: 22px !important;
}

.money-wrap>input[readonly] {
  background: #f9fafb;
}