:root {
  --blue: #0b4f6c;
  --blue-dark: #08374b;
  --teal: #1b9aaa;
  --accent: #ff8c1a;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1f2d35;
  --muted: #6b7c85;
  --border: #e1e7eb;
  --ok: #2e9e5b;
  --warn: #d98b00;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(11, 79, 108, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--blue-dark); line-height: 1.25; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }

/* Header public */
.site-header {
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.25rem; color: #fff; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 8px; background: var(--accent);
  display: grid; place-items: center; font-weight: 800; color: #fff; letter-spacing: -1px;
}
.site-nav { display: flex; gap: 22px; align-items: center; }
.site-nav a { color: #d8e6ec; font-weight: 500; }
.site-nav a:hover, .site-nav a.active { color: #fff; }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: var(--radius);
  border: none; cursor: pointer; font-weight: 600; font-size: .95rem; background: var(--accent); color: #fff;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn-blue { background: var(--blue); }
.btn-teal { background: var(--teal); }
.btn-ghost { background: transparent; border: 1px solid currentColor; color: var(--blue); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-danger { background: var(--danger); }
.btn-block { display: block; width: 100%; text-align: center; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--blue-dark), var(--teal));
  color: #fff; padding: 70px 0;
}
.hero h1 { color: #fff; font-size: 2.4rem; margin: 0 0 14px; }
.hero p { font-size: 1.15rem; max-width: 640px; opacity: .95; }
.hero .actions { margin-top: 26px; display: flex; gap: 14px; flex-wrap: wrap; }

/* Sections */
.section { padding: 56px 0; }
.section.alt { background: #fff; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; }
.service-icon {
  width: 54px; height: 54px; border-radius: 12px; background: rgba(27,154,170,.12);
  color: var(--teal); display: grid; place-items: center; font-size: 1.5rem; margin-bottom: 14px; font-weight: 800;
}

/* Forms */
form .field { margin-bottom: 14px; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; color: var(--blue-dark); }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(27,154,170,.15); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.alert-ok { background: #e6f6ec; color: var(--ok); border: 1px solid #b6e3c6; }
.alert-err { background: #fdeceb; color: var(--danger); border: 1px solid #f3c4bf; }
.muted { color: var(--muted); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.badge-blue { background: #e2eef4; color: var(--blue); }
.badge-teal { background: #e0f3f5; color: var(--teal); }
.badge-ok { background: #e6f6ec; color: var(--ok); }
.badge-warn { background: #fdf1dc; color: var(--warn); }
.badge-danger { background: #fdeceb; color: var(--danger); }
.badge-gray { background: #eef1f3; color: var(--muted); }

/* Tables */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: .92rem; }
th { background: var(--blue); color: #fff; font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fbfc; }

/* Internal layout */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; background: var(--blue-dark); color: #cfe1e9; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar nav { padding: 12px; flex: 1; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 8px;
  color: #cfe1e9; font-weight: 500; margin-bottom: 4px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--teal); color: #fff; }
.sidebar .foot { padding: 14px 20px; font-size: .8rem; border-top: 1px solid rgba(255,255,255,.08); }
.app-main { flex: 1; padding: 28px 34px; overflow-x: auto; }
.app-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 26px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.kpi .val { font-size: 1.7rem; font-weight: 800; color: var(--blue); }
.kpi .lbl { font-size: .82rem; color: var(--muted); }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell { min-height: 96px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; font-size: .8rem; }
.cal-cell.empty { background: transparent; border: none; }
.cal-cell.today { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,140,26,.25); }
.cal-head { text-align: center; font-weight: 700; color: var(--blue); padding: 6px 0; font-size: .82rem; }
.cal-item { display: block; background: var(--teal); color: #fff; border-radius: 5px; padding: 2px 6px; margin-top: 4px; font-size: .74rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-item.warn { background: var(--accent); }
.cal-item.gray { background: var(--muted); }
.cal-item.order { background: var(--blue); }
.cal-item.span { border-left: 3px solid rgba(0,0,0,.25); font-style: italic; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: .82rem; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }

.page-title { font-size: 1.5rem; margin: 0 0 4px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.print-only { display: none; }
@media print {
  .sidebar, .app-topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .container, .app-main { padding: 0; }
  .card, table { box-shadow: none; }
  .print-only { display: block; }
}
.footer-public { background: var(--blue-dark); color: #b9cdd6; padding: 30px 0; margin-top: 0; font-size: .9rem; }
.footer-public a { color: #d8e6ec; }

/* ── Mobile / Responsive ── */
.hamburger-input { display: none; }
.hamburger-btn, .sidebar-overlay { display: none; }

@media (max-width: 768px) {
  /* Hamburger */
  .hamburger-btn {
    display: flex; position: fixed; top: 12px; left: 12px; z-index: 200;
    width: 40px; height: 40px; background: var(--blue-dark); color: #fff;
    border-radius: 8px; align-items: center; justify-content: center;
    font-size: 1.4rem; cursor: pointer; border: none;
  }
  .hamburger-input:checked + .hamburger-btn + .sidebar-overlay { display: block; }

  /* Overlay */
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.4);
    z-index: 149; display: none;
  }
  .hamburger-input:checked + .hamburger-btn + .sidebar-overlay {
    display: block;
  }

  /* Sidebar slide-in */
  .sidebar {
    position: fixed; left: -280px; top: 0; z-index: 150;
    transition: left .25s ease; height: 100vh;
  }
  .hamburger-input:checked ~ .sidebar { left: 0; }

  /* Main */
  .app-main { padding: 16px; padding-top: 60px; overflow-x: auto; }

  /* KPI grid */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }

  /* Grids → stacked */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }

  /* Calendar */
  .calendar { gap: 3px; }
  .cal-cell { min-height: 56px; font-size: .7rem; padding: 3px; }
  .cal-head { font-size: .7rem; padding: 4px 0; }
  .cal-item { font-size: .65rem; }

  /* Cards */
  .card { padding: 18px; }

  /* Tables – force horizontal scroll */
  .app-main { overflow-x: auto; }
  table { font-size: .85rem; }
  th, td { padding: 8px 10px; white-space: nowrap; }

  /* Public header */
  .site-header .container { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 8px; }
  .site-nav { gap: 12px; flex-wrap: wrap; }

  /* Hero */
  .hero { padding: 40px 0; }
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: 1rem; }

  /* Topbar */
  .app-topbar { flex-direction: column; align-items: flex-start; }

  /* Page title */
  .page-title { font-size: 1.25rem; }

  /* Full-width buttons in action rows */
  .actions-row .btn:not(.btn-sm) { width: 100%; text-align: center; }

  /* Search fields – full width on mobile */
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input[type="search"] { width: 100%; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi .val { font-size: 1.3rem; }
}
