:root {
  --accent: #f97316;
  --accent-dark: #ea580c;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a, button, input, select, textarea {
  color: inherit;
  text-decoration: none;
  font-family: inherit;
}

button { cursor: pointer; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  padding: 11px 18px;
  font-weight: 700;
  font-size: 13.5px;
  border: none;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-dark { background: var(--ink); color: #fff; }

/* Cards */
.card {
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--line);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-accent { background: color-mix(in srgb, var(--accent) 16%, white); color: var(--accent); }
.badge-muted { background: #f1f5f9; color: var(--muted); }

/* Chips (filters / day picker) */
.chip {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 13px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.daychip {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 44px;
  cursor: pointer;
}
.daychip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Tabs */
.tabbar { display: flex; gap: 6px; background: #eef1f5; border-radius: 13px; padding: 4px; width: fit-content; }
.tab { padding: 9px 16px; border-radius: 11px; font-weight: 700; font-size: 12.5px; cursor: pointer; border: none; background: transparent; color: var(--muted); }
.tab.active { background: #fff; color: var(--accent); box-shadow: 0 1px 2px rgba(15,23,42,.08); }

/* Forms */
label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
}
.field { margin-bottom: 14px; }

/* Tables */
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }

.actbtn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

/* Painel layout */
.layout { width: 100%; min-height: 100vh; display: flex; flex-wrap: wrap; background: var(--bg); }
.sidebar {
  flex: 1 1 240px;
  max-width: 240px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sidebar.dark { background: var(--ink); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 20px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.navitem { padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.navitem svg { flex-shrink: 0; }
.navitem.active { background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); }
.navitem.disabled { opacity: .45; cursor: default; }
main.content { flex: 999 1 560px; min-width: 0; padding: 28px 32px; display: flex; flex-direction: column; gap: 18px; position: relative; }

@media (max-width: 720px) {
  main.content { padding: 20px 16px; gap: 14px; }
  .sidebar { max-width: none; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; }
  .sidebar > div:first-child { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; }
  .sidebar .brand { padding: 0; }
  .sidebar nav { flex-direction: row !important; flex-wrap: wrap; gap: 6px !important; }
  .navitem span.navitem-label { display: none; }
  .navitem { padding: 9px; }
}

/* Stat cards with icon */
.stat-card { display: flex; align-items: flex-start; gap: 12px; padding: 16px; }
.stat-icon { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: color-mix(in srgb, var(--accent) 14%, white); color: var(--accent); }
.stat-icon.muted { background: #f1f5f9; color: var(--muted); }

/* Alerts */
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.alert-icon { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: color-mix(in srgb, var(--accent) 16%, white); color: var(--accent); }
.alert-icon.muted { background: #f1f5f9; color: var(--muted); }

/* Notification bell */
.bell-wrap { position: relative; }
.bell-btn { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.2); border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; color: inherit; position: relative; }
.bell-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.bell-panel {
  position: absolute; top: 44px; right: 0; width: 260px; background: #fff; color: var(--ink);
  border-radius: 14px; border: 1px solid var(--line); box-shadow: 0 16px 40px -14px rgba(15,23,42,.35);
  padding: 8px; display: none; z-index: 60;
}
.bell-panel.open { display: block; }
.bell-item { display: flex; gap: 10px; padding: 9px 8px; border-radius: 10px; }
.bell-item:hover { background: #f8fafc; }

/* Back-to-index pill */
.back-pill {
  position: fixed; top: 14px; left: 14px; z-index: 200;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600;
  padding: 7px 12px 7px 10px; border-radius: 999px; display: inline-flex;
  align-items: center; gap: 6px; text-decoration: none; box-shadow: 0 6px 16px -6px rgba(15,23,42,.5);
}

@media (max-width: 480px) {
  .phone {
    width: 100%;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .back-pill { padding: 6px 10px 6px 8px; font-size: 11px; }
}

/* Hub (index) cards */
.hub-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.hub-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 12px 28px -16px rgba(15,23,42,.25); transform: translateY(-1px); }
.hub-icon { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: color-mix(in srgb, var(--accent) 14%, white); color: var(--accent); }
.hub-icon.dark { background: var(--ink); color: #fff; }

/* Portal (phone) shell */
.phone {
  width: 390px;
  height: 844px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  margin: 24px auto;
  border-radius: 28px;
  box-shadow: 0 20px 50px -20px rgba(15,23,42,.35);
}
.phone-header {
  background: var(--accent);
  color: #fff;
  padding: 18px 20px 20px;
  border-radius: 0 0 24px 24px;
  flex-shrink: 0;
}
.phone-body { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.phone-nav { display: flex; border-top: 1px solid var(--line); background: #fff; flex-shrink: 0; padding-bottom: 6px; }
.navlink { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); flex: 1; padding: 8px 0; }
.navlink.active { color: var(--accent); }

.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; opacity: .9; color: #fff; }

/* Modal overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.overlay.open { display: flex; }

.switch { width: 38px; height: 22px; border-radius: 999px; position: relative; flex-shrink: 0; background: #e2e8f0; }
.switch.on { background: var(--accent); }
.switch-dot { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on .switch-dot { left: 18px; }

.hidden { display: none !important; }
