/* Medina Trailers — palette inherited from project.spot/takeoff */
:root {
  --bg:#f4ede0; --bg1:#fff; --bg2:#faf5ee; --bg3:#ece5d8;
  --am:#c8820d; --am2:#e09a18; --am-lt:#fff3d6; --am-dk:#7a5002;
  --gr:#1a7a48; --gr-lt:#e5f4ec; --rd:#c0392b; --rd-lt:#fdecea;
  --tx:#1e1b16; --tx1:#4a4540; --tx2:#887f74;
  --bd:#ddd4c2; --bd2:#bfb5a2;
  --nav:#1a1712; --nav-tab:#ccc4b8; --nav-active:#f5b942;
  --radius:10px; --shadow:0 2px 8px rgba(0,0,0,.06);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
[data-theme="dark"] {
  --bg:#1a1712; --bg1:#242018; --bg2:#2a251e; --bg3:#332e25;
  --am:#e09a18; --am2:#f5b942; --am-lt:#3d3018; --am-dk:#f5c96a;
  --gr:#2ecc71; --gr-lt:#1a2e1e; --rd:#e74c3c; --rd-lt:#2e1a1a;
  --tx:#e8e0d4; --tx1:#c4baa8; --tx2:#9a9088;
  --bd:#3d3628; --bd2:#4a4030;
  --nav:#0e0c09; --nav-tab:#8a8078; --nav-active:#f5b942;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body { font-family: var(--sans); background: var(--bg); color: var(--tx); line-height: 1.45; }
a { color: var(--am-dk); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

/* ===== Sidebar — light, modern SaaS-style ===== */
.sidebar {
  width: 256px;
  flex-shrink: 0;
  background: #fbf8f1;           /* warm off-white, matches brand cream */
  border-right: 1px solid var(--bd);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 50;
}

/* Brand area */
.sidebar-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--bd);
  min-height: 100px;
}
.sidebar-brand-link { display: flex; align-items: center; justify-content: center; flex: 1; }
.sidebar-brand-logo { max-height: 72px; max-width: 180px; width: auto; display: block; }
.sidebar-close {
  display: none;
  background: transparent; border: 0; cursor: pointer;
  color: var(--tx1); padding: 6px; border-radius: 6px;
}
.sidebar-close:hover { background: var(--bg3); color: var(--tx); }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 8px;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--bd); border-radius: 3px; }

.nav-section { margin-bottom: 2px; }
.nav-section + .nav-section { margin-top: 4px; }

.nav-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--tx2);
  padding: 12px 10px 6px;
  user-select: none;
  border-radius: 6px;
  transition: color .14s ease, background .14s ease;
}
.nav-group-label:hover { color: var(--am-dk); background: rgba(200,130,13,.06); }
.nav-group-label .nav-ico { color: inherit; opacity: .65; transition: transform .22s ease, opacity .14s ease; }
.nav-group-label:hover .nav-ico { opacity: 1; }
.nav-section.collapsed .nav-group-label .nav-ico { transform: rotate(-90deg); }

.sidebar-nav > .nav-section:first-child .nav-group-label { padding-top: 2px; }

.nav-section-items {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows .22s ease;
  overflow: hidden;
}
.nav-section-items > * { min-height: 0; }
.nav-section.collapsed .nav-section-items { grid-template-rows: 0fr; }

/* Wrap inner content so transition can animate an auto-height child */
.nav-section-items { display: flex; flex-direction: column; gap: 0; }
.nav-section.collapsed .nav-section-items { max-height: 0; padding: 0; opacity: 0; }
.nav-section-items { max-height: 500px; opacity: 1; transition: max-height .25s ease, opacity .15s ease, padding .2s ease; padding-bottom: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--tx1);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  transition: background .14s ease, color .14s ease, transform .06s ease;
  position: relative;
}
.nav-item:hover {
  background: #f3ecda;
  color: var(--tx);
  text-decoration: none;
}
.nav-item .nav-ico { color: var(--tx2); flex-shrink: 0; transition: color .14s ease; }
.nav-item:hover .nav-ico { color: var(--am-dk); }

.nav-item.active {
  background: var(--am-lt);
  color: var(--am-dk);
  font-weight: 600;
}
.nav-item.active .nav-ico { color: var(--am-dk); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--am);
}

/* Profile block */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--bd);
  background: #f7f2e6;
}
.profile-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--am), var(--am-dk));
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.profile-info {
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}
.profile-email {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tx);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-role {
  font-size: 11px;
  color: var(--tx2);
  margin-top: 2px;
}
.profile-logout { margin: 0; flex-shrink: 0; }
.profile-logout-btn {
  background: transparent;
  border: 1px solid var(--bd2);
  border-radius: 6px;
  padding: 6px;
  color: var(--tx1);
  cursor: pointer;
  display: flex; align-items: center;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.profile-logout-btn:hover { background: var(--rd-lt); color: var(--rd); border-color: var(--rd); }

/* Mobile toggle (hamburger) */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 45;
  background: var(--bg1);
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: var(--tx1);
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.sidebar-toggle:hover { background: var(--bg2); color: var(--tx); }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(30, 27, 22, 0.45);
  z-index: 40;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Mobile layout — drawer */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-backdrop,
  .sidebar-backdrop:not([hidden]) { display: block; }
  .sidebar-close { display: inline-flex; }
  .sidebar-toggle { display: inline-flex; }
  .main { padding-top: 64px !important; }
}
.main { flex: 1; padding: 24px 32px; max-width: 100%; }

.topbar { display:flex; align-items:center; justify-content: space-between; margin-bottom: 20px; }
.topbar h1 { margin: 0; font-size: 22px; }

.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.flash.success { background: var(--gr-lt); color: var(--gr); border: 1px solid var(--gr); }
.flash.error { background: var(--rd-lt); color: var(--rd); border: 1px solid var(--rd); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { background: var(--bg1); border: 1px solid var(--bd); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: block; color: inherit; text-decoration: none; transition: transform .08s ease, box-shadow .12s ease, border-color .12s ease; }
a.card:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.08); border-color: var(--bd2); text-decoration: none; }
.card .label { color: var(--tx2); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.card .value { font-size: 26px; font-weight: 700; color: var(--tx); margin-top: 6px; }
.card .value.am { color: var(--am-dk); }
.card .value.gr { color: var(--gr); }
.card .value.rd { color: var(--rd); }

.section { background: var(--bg1); border: 1px solid var(--bd); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.section h2 { margin: 0 0 14px; font-size: 16px; color: var(--tx1); }

table { width: 100%; border-collapse: collapse; background: var(--bg1); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--bd); font-size: 14px; }
th { color: var(--tx2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr:hover td { background: var(--bg2); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.badge.gr { background: var(--gr-lt); color: var(--gr); }
.badge.am { background: var(--am-lt); color: var(--am-dk); }
.badge.rd { background: var(--rd-lt); color: var(--rd); }
.badge.gy { background: var(--bg3); color: var(--tx1); }

.btn { display: inline-block; padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--bd2); background: var(--bg1); color: var(--tx); font-weight: 600; cursor: pointer; font-size: 14px; }
.btn:hover { background: var(--bg2); text-decoration: none; }
.btn.primary { background: var(--am); border-color: var(--am-dk); color: #fff; }
.btn.primary:hover { background: var(--am-dk); }
.btn.danger { background: var(--rd); border-color: var(--rd); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; color: var(--tx1); margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--bd2); border-radius: 6px; background: var(--bg1); color: var(--tx); font-size: 14px; font-family: var(--sans);
}
textarea { min-height: 80px; }

.public-shell { max-width: 520px; margin: 60px auto; padding: 28px; background: var(--bg1); border: 1px solid var(--bd); border-radius: var(--radius); box-shadow: var(--shadow); }
.public-shell h1 { margin-top: 0; color: var(--am-dk); }

/* Legacy 800px sidebar block removed — replaced by drawer in @media (max-width: 900px) above and mobile.css */
