/* ═══════════════════════════════════════════════════════
   FleetCRM — DataFa.st–inspired design system
   Light theme · Coral accent · Inter font
═══════════════════════════════════════════════════════ */
:root {
  --bg:           #F7F7F7;
  --surface:      #FFFFFF;
  --border:       #EBEBEB;
  --border-md:    #D4D4D4;
  --text:         #111111;
  --text-muted:   #888888;
  --text-dim:     #555555;
  --coral:        #E8603C;
  --coral-hover:  #D4502C;
  --coral-light:  #FEF0ED;
  --coral-bar:    rgba(232,96,60,.15);
  --green:        #16A34A;
  --green-light:  #F0FDF4;
  --red:          #DC2626;
  --red-light:    #FEF2F2;
  --yellow:       #D97706;
  --blue:         #2563EB;
  --blue-light:   #EFF6FF;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,.08);
}

/* ── Reset & base ──────────────────────────────────────── */
* { box-sizing: border-box; }

html, body, BODY, P, TD, PRE {
  font-family: 'Inter', Tahoma, sans-serif;
  font-size: 13px;
  color: var(--text);
  margin: 0; padding: 0;
}

body, BODY { background: var(--bg); }

a { text-decoration: none; color: var(--coral); }
a:hover { color: var(--coral-hover); }

/* ── Layout ────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.logo-icon { color: var(--coral); font-size: 20px; line-height: 1; }
.logo-text { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -.3px; }

.nav-section {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-muted);
  padding: 10px 8px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 450;
  color: var(--text-dim);
  cursor: pointer; text-decoration: none;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active {
  background: var(--coral-light);
  color: var(--coral);
  font-weight: 500;
}
.nav-item .ni { width: 15px; text-align: center; font-size: 13px; }

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* ── Main content area ─────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Topbar ────────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 54px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 14px; font-weight: 600; color: var(--text); }
.topbar-slash { color: var(--border-md); }
.topbar-sub   { font-size: 13px; color: var(--text-muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ── Page body padding ─────────────────────────────────── */
.page-body { padding: 24px; flex: 1; overflow: auto; }

/* ── Buttons ───────────────────────────────────────────── */
INPUT[type=submit], INPUT[type=button], button,
.button, .button2, .button3, .button4, .button5, .button12,
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 500;
  cursor: pointer; border: none;
  transition: all .12s; white-space: nowrap;
  line-height: 1.4; text-decoration: none;
}
INPUT[type=submit]:active, .btn:active { opacity: .88; }

/* Primary coral — Add Order */
.btn-coral, .button {
  background: var(--coral); color: #fff;
  box-shadow: 0 1px 4px rgba(232,96,60,.3);
}
.btn-coral:hover, .button:hover { background: var(--coral-hover); color: #fff; }

/* Outline — period filters */
.btn-outline, .button2 {
  background: var(--surface); color: var(--text-dim);
  border: 1px solid var(--border-md);
  box-shadow: var(--shadow);
}
.btn-outline:hover, .button2:hover { border-color: #bbb; color: var(--text); }
.btn-outline.active {
  background: var(--coral-light); color: var(--coral);
  border-color: rgba(232,96,60,.3);
}

/* Ghost */
.btn-ghost, .button3 {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover, .button3:hover { background: var(--bg); color: var(--text); }

/* Teal = user management */
.button4 {
  background: #0891B2; color: #fff;
}
.button4:hover { background: #0E7490; }

/* Green = config */
.button5 {
  background: var(--green); color: #fff;
}
.button5:hover { background: #15803D; }

/* ── Form inputs ───────────────────────────────────────── */
INPUT[type=text], SELECT, TEXTAREA, .filter-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-family: 'Inter', sans-serif; font-size: 12px;
  color: var(--text); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
INPUT[type=text]:focus, SELECT:focus, TEXTAREA:focus, .filter-input:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(232,96,60,.1);
}
INPUT[type=text]::placeholder, .filter-input::placeholder { color: var(--text-muted); }
INPUT.radio { border: none; background: transparent; box-shadow: none; padding: 0; }

/* ── Stat cards ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); margin-bottom: 8px;
}
.stat-value {
  font-size: 26px; font-weight: 700;
  color: var(--text); letter-spacing: -.5px; margin-bottom: 4px;
}
.stat-sub { font-size: 11px; color: var(--text-muted); }
.up   { color: var(--green); font-weight: 500; }
.down { color: var(--red);   font-weight: 500; }

/* ── Filter bar ─────────────────────────────────────────── */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 11px 16px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.filter-sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }

/* ── Card / table wrapper ───────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}
.card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.card-count {
  font-size: 11px; font-weight: 500;
  background: var(--bg); color: var(--text-muted);
  padding: 2px 8px; border-radius: 20px;
  border: 1px solid var(--border);
}

/* ── Tab strip ──────────────────────────────────────────── */
.tab-strip { display: flex; }
.tab {
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  padding: 8px 14px; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }

/* ── Main orders table ──────────────────────────────────── */
#table1, table.crm-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

#table1 thead th,
#table1 td[bgcolor="#CC99FF"],
#table1 td[bgcolor="#ccc"],
table.crm-table thead th {
  font-size: 10px !important; font-weight: 600 !important;
  text-transform: uppercase !important; letter-spacing: .6px !important;
  color: var(--text-muted) !important;
  padding: 10px 14px !important;
  text-align: left !important;
  border-bottom: 1px solid var(--border) !important;
  background: var(--surface) !important;
  white-space: nowrap;
  vertical-align: bottom;
}

/* Override bgcolor on header cells */
#table1 td[bgcolor="#CC99FF"] { color: var(--text-muted) !important; }
#table1 td[bgcolor="#ccc"]    { color: var(--text-muted) !important; }

/* Data rows */
#table1 tbody td,
#table1 td:not([bgcolor="#CC99FF"]):not([bgcolor="#ccc"]):not([bgcolor="#F4F4F4"]):not([bgcolor="FF6600"]):not([bgcolor="#FF6600"]):not([bgcolor="#C0C0C0"]):not([bgcolor="00FFFF"]),
table.crm-table tbody td {
  padding: 10px 14px !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: 12px !important;
  color: var(--text-dim) !important;
  vertical-align: middle !important;
  background: var(--surface) !important;
}

/* Row hover */
#table1 tr:hover td { background: var(--coral-light) !important; }

/* Totals row */
#table1 tr[bgcolor="FF6600"] td,
#table1 tr[bgcolor="#FF6600"] td {
  background: var(--bg) !important;
  color: var(--text-dim) !important;
  font-weight: 600 !important;
  border-top: 1px solid var(--border-md) !important;
  border-bottom: none !important;
  font-size: 12px !important;
}

/* Amount cells */
.payed   { color: var(--green) !important; font-weight: 600 !important; }
.unpayed { color: var(--red)   !important; font-weight: 600 !important; }

/* Paid / unpaid background override */
td[bgcolor="#9BFA68"] { background: var(--green-light) !important; }
td[bgcolor="#FA8268"] { background: var(--red-light)   !important; }

/* ── Action icon buttons ─────────────────────────────────── */
td a[title="Edit"]   .fa-pen-to-square,
td a[title="Restore"] img { color: var(--blue); }
td a[title="Paid"]   .fa-credit-card { color: var(--green); }
td a[title="Delete"] .fa-trash-can   { color: var(--red);   }

td a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 27px; height: 27px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  transition: all .12s;
  box-shadow: var(--shadow);
}
td a:hover { background: var(--bg); color: var(--text); border-color: var(--border-md); }
td a.payed:hover, td a.unpayed:hover {
  background: var(--green-light); color: var(--green); border-color: #86EFAC;
}

/* ── Summary table ──────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.sum-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.sum-card h4 {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); margin-bottom: 12px;
}
.sum-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.sum-row:last-child { border-bottom: none; }
.sum-label { color: var(--text-muted); }
.sum-val   { font-weight: 600; color: var(--text); }

/* Inline summary table (original PHP output) */
table[border="0"] td { border: none !important; padding: 4px 12px 4px 0 !important; font-size: 12px !important; }
table[border="0"] td:last-child { font-weight: 600; color: var(--coral); }

/* ── Avatar ─────────────────────────────────────────────── */
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--coral-light);
  border: 1.5px solid rgba(232,96,60,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--coral);
}

/* ── Alerts ─────────────────────────────────────────────── */
.success, .warning {
  position: fixed; top: 0; left: 0; right: 0;
  padding: 14px 14px 14px 50px;
  background-repeat: no-repeat; background-position: 14px center;
  z-index: 999; font-size: 13px;
}
.success {
  background-color: var(--green-light); color: #065F46;
  background-image: url('images/success.png');
  border-bottom: 2px solid var(--green);
}
.warning {
  background-color: #FFFBEB; color: #92400E;
  background-image: url('images/warning.png');
  border-bottom: 2px solid var(--yellow);
}

/* ── Search bar ─────────────────────────────────────────── */
.searchbar {
  position: absolute; width: 165px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); z-index: 99;
}
.asearch { background: var(--surface); cursor: pointer; padding: 6px 12px; font-size: 12px; }
.asearch:hover { background: var(--bg); }

/* ── Typography helpers ─────────────────────────────────── */
h1 { color: var(--text); font-size: 22px; font-weight: 700; font-family: 'Inter', sans-serif; }
h2 { color: var(--text); font-size: 16px; font-weight: 600; font-family: 'Inter', sans-serif; }
h3,h4,h5,h6 { color: var(--text); font-family: 'Inter', sans-serif; }

.b            { font-weight: 600; }
.oranj-t      { color: var(--coral); }
.blue-t       { color: var(--blue); }
.red-t        { color: var(--red); }
.green-t      { color: var(--green); }
.gray-t       { color: var(--text-muted); }
.black-t      { color: var(--text); }
.alert        { color: var(--red); font-size: 12px; }
.error        { color: var(--red); font-size: 16px; }

/* ── iframe (add order panel) ───────────────────────────── */
#collapseobj_vote {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
