:root {
  --teal: #12B0B8;
  --petrol: #0E5F6E;
  --petrol-dark: #0a4a56;
  --ink: #16343a;
  --muted: #5a7378;
  --bg: #f3fafb;
  --card: #ffffff;
  --line: #d5e6e8;
  --ok: #1d7a5c;
  --ok-bg: #e5f6ef;
  --warn: #9a6b00;
  --warn-bg: #fff4d6;
  --err: #b42318;
  --err-bg: #fdecea;
  --shadow: 0 8px 24px rgba(14, 95, 110, 0.08);
  --radius: 16px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  min-height: 100dvh;
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
}
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.app-header {
  background: var(--petrol);
  color: #fff;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "brand actions";
  align-items: start;
  gap: 10px 14px;
  padding: calc(14px + var(--safe-t)) 14px 14px;
}
.app-header .header-brand {
  grid-area: brand;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.app-header .logo { height: 58px; width: auto; max-width: min(260px, 70vw); }
.app-header .titles { min-width: 0; background: transparent; padding: 0; }
.app-header h1 { font-size: 1.02rem; margin: 0; font-weight: 650; color: #fff; }
.app-header p { margin: 0; font-size: 0.8rem; color: rgba(255,255,255,.88); }
.app-header .header-actions { grid-area: actions; }
@media (min-width: 768px) {
  .app-header {
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "logo titles actions";
    align-items: center;
    gap: 16px 24px;
    padding: calc(16px + var(--safe-t)) 24px 16px;
  }
  .app-header .header-brand { display: contents; }
  .app-header .logo {
    grid-area: logo;
    justify-self: start;
    flex-shrink: 0;
    height: 58px;
    max-width: none;
  }
  .app-header .titles {
    grid-area: titles;
    justify-self: center;
    text-align: center;
  }
  .app-header .header-actions {
    grid-area: actions;
    justify-self: end;
  }
  .app-header h1 { font-size: 1.12rem; }
}
.wrap { max-width: 980px; margin: 0 auto; padding: 16px 16px calc(24px + var(--safe-b)); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.logo-login { width: min(280px, 80vw); margin: 8px auto 18px; }
.center { text-align: center; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
label { display: block; font-size: 0.85rem; font-weight: 600; margin: 10px 0 4px; }
input, select, textarea {
  width: 100%;
  padding: 12px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  min-height: 44px;
}
textarea { min-height: 80px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .row.collapse { grid-template-columns: 1fr; } }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; min-height: 44px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid transparent; font-weight: 650; text-decoration: none;
}
.btn-primary { background: var(--petrol); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--petrol-dark); }
.btn-teal { background: var(--teal); color: #07383d; width: 100%; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--petrol); }
.btn-danger { background: var(--err-bg); color: var(--err); border-color: #f3c0bc; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.btn-sm { min-height: 40px; padding: 8px 10px; font-size: 0.9rem; }
.info {
  background: #e8f6f7; color: var(--petrol-dark); border-radius: 12px;
  padding: 10px 12px; font-size: 0.85rem; margin: 8px 0 12px;
}
.muted { color: var(--muted); font-size: 0.9rem; }
.hours {
  font-size: 1.35rem; font-weight: 700; color: var(--petrol); margin: 8px 0 4px;
}
.tabs { display: flex; gap: 8px; margin: 0 0 14px; }
.tabs button {
  flex: 1; min-height: 44px; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; font-weight: 650; color: var(--petrol);
}
.tabs button.active { background: var(--petrol); color: #fff; border-color: var(--petrol); }
.chip {
  display: inline-block; border-radius: 999px; padding: 2px 8px;
  font-size: 0.75rem; font-weight: 650;
}
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-err { background: var(--err-bg); color: var(--err); }
.chip-info { background: #e8f6f7; color: var(--petrol); }
.banner {
  border-radius: 14px; padding: 14px; margin-bottom: 14px;
  background: var(--warn-bg); border: 1px solid #ead89a;
}
.banner h3 { margin: 0 0 6px; font-size: 1rem; }
.error { color: var(--err); font-size: 0.9rem; margin: 8px 0 0; }
.day-group { margin-bottom: 16px; }
.day-group h3 { font-size: 0.95rem; margin: 0 0 8px; display: flex; justify-content: space-between; }
.entry {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; background: #fff;
}
.entry .meta { font-size: 0.85rem; color: var(--muted); }
.entry-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dialog-back {
  position: fixed; inset: 0; background: rgba(6, 30, 34, 0.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 40;
  padding: 0 0 var(--safe-b);
}
.dialog {
  background: #fff; width: 100%; max-width: 520px; border-radius: 20px 20px 0 0;
  padding: 18px 16px 20px; max-height: 92dvh; overflow: auto;
}
@media (min-width: 640px) {
  .dialog-back { align-items: center; padding: 20px; }
  .dialog { border-radius: 20px; }
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 650; }
.status-dot { font-size: 0.8rem; }
.install-help { font-size: 0.9rem; }
.install-help ol { margin: 8px 0 0; padding-left: 18px; }
.header-actions { display: flex; gap: 8px; flex-shrink: 0; }
.header-actions .btn { width: auto; background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ended { opacity: 0.75; }

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  background: #fff;
  color: var(--text, #123);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(6, 30, 34, 0.18);
  padding: 6px;
  z-index: 30;
}
.menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.menu button:hover, .menu button:focus { background: #eef7f8; }
