:root {
  --bg: #f4f6f8; --card: #fff; --text: #1d2733; --muted: #6b7785; --line: #e2e7ec;
  --gruen: #16a34a; --orange: #f59e0b; --rot: #dc2626; --grau: #9ca3af; --blue: #0b3d91;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
       background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.45; }
a { color: var(--blue); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 8px 0 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: .85rem; }
.error { color: var(--rot); }
.ok { color: var(--gruen); font-weight: 600; }

.top { background: #1a1d23; color: #fff; padding: 14px 24px;
       display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; color: #fff; flex-wrap: wrap; }
.brand img { height: 84px; object-fit: contain; border-radius: 4px; display: block; }
.logo-ocean { width: 84px; }
.logo-nvl { width: 138px; }
.brand-text { font-weight: 800; font-size: 1.1rem; }
.brand-title { font-size: 20px; font-weight: 700; }
.top-right { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; font-size: 14px; }
.who { opacity: .85; }
nav { display: flex; gap: 16px; flex-wrap: wrap; }
nav a { text-decoration: none; font-weight: 600; color: #fff; }
nav a:hover { color: #c7d2fe; }
nav a.faint { opacity: .7; }

.card { background: var(--card); border-radius: 12px; padding: 16px; margin-bottom: 16px;
        box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid .card { margin-bottom: 0; }
.grid { margin-bottom: 16px; }

.lights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.light { border-radius: 16px; color: #fff; text-decoration: none; padding: 20px 8px; text-align: center;
         display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 600;
         box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.light .count { font-size: 2.8rem; line-height: 1; font-weight: 800; }
.light.gruen { background: var(--gruen); }
.light.orange { background: var(--orange); }
.light.rot { background: var(--rot); }
.light:active { transform: scale(.98); }

.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.figures dt { color: var(--muted); font-size: .85rem; }
.figures dd { margin: 0; font-size: 1.3rem; font-weight: 700; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600;
        color: #fff; background: var(--grau); }
.pill.gruen { background: var(--gruen); } .pill.orange { background: var(--orange); } .pill.rot { background: var(--rot); }
.dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: var(--grau); flex: none; }
.dot.gruen { background: var(--gruen); } .dot.orange { background: var(--orange); } .dot.rot { background: var(--rot); }

.mast-list { display: flex; flex-direction: column; gap: 8px; }
.mast-row { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 12px;
            padding: 14px 16px; text-decoration: none; color: var(--text); flex-wrap: wrap;
            box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.mast-name { flex: 1 1 200px; }
.lamps { display: flex; gap: 6px; flex-wrap: wrap; }

.lamp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.lamp-cards .card { margin-bottom: 0; border-top: 6px solid var(--grau); }
.lamp.gruen { border-top-color: var(--gruen); } .lamp.orange { border-top-color: var(--orange); } .lamp.rot { border-top-color: var(--rot); }
.lamp-head { display: flex; justify-content: space-between; align-items: center; }
.lamp-head h2 { margin: 0; }
.big { font-size: 2rem; font-weight: 800; margin: 8px 0 0; }
details summary { cursor: pointer; color: var(--blue); font-weight: 600; margin-top: 8px; }
.lamp-form { display: grid; gap: 8px; margin-top: 8px; }

.chart { position: relative; height: 300px; }

.form-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin: 4px 0 12px; }
.form-actions:last-child { margin: 12px 0 0; }
.targets td { vertical-align: middle; }
.targets tr.mast-start td { border-top: 2px solid var(--line); }
.mast-cell { vertical-align: top !important; }
input.num { width: 110px; margin: 0; padding: 8px; }

.who { color: #fff; text-decoration: none; }
.m-only-link { display: none; }
.note { background: #fff7e6; border-left: 4px solid var(--orange); padding: 10px 12px; border-radius: 6px; }

.sched-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.sched-row { display: flex; gap: 28px; margin-top: 6px; }
.sched-row > div { display: flex; flex-direction: column; }
.sched-row strong { font-size: 1.6rem; line-height: 1.2; }
.sched-row sup { font-size: .7rem; color: var(--muted); margin-left: 2px; }

.period-head { display: flex; justify-content: space-between; align-items: center; }
.period-head h2 { margin: 0; }
.period-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 12px 0 0; display: grid; gap: 8px; }
legend { font-weight: 700; padding: 0 6px; }
select { display: block; width: 100%; padding: 10px; font-size: 1rem; border: 1px solid var(--line);
         border-radius: 8px; margin-top: 4px; background: #fff; color: var(--text); }
label.inline { display: flex; align-items: center; gap: 8px; color: var(--text); }
label.inline input { width: auto; margin: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.user-form { display: grid; gap: 12px; }
td.wrap { white-space: normal; }
button.danger { background: #fde8e8; color: var(--rot); }
.sched-side[data-kind="fixed"] .for-sun { display: none; }
.sched-side:not([data-kind="fixed"]) .for-fixed { display: none; }
.sun-row { display: grid; grid-template-columns: 80px 120px 1fr; gap: 8px; align-items: center; margin: 4px 0 8px; }
.sun-row input, .sun-row select { margin: 0; }
.sun-name { font-weight: 600; }
.bad-toggle { margin-top: 4px; }
.wx { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; margin-top: 2px; width: fit-content; }
.wx.good { background: #e8f5e9; color: #166534; }
.wx.bad { background: #e0e7ff; color: #3730a3; }

label { display: block; font-size: .9rem; color: var(--muted); }
input { display: block; width: 100%; padding: 10px; font-size: 1rem; border: 1px solid var(--line);
        border-radius: 8px; margin-top: 4px; color: var(--text); }
button { padding: 11px 14px; font-size: 1rem; border: 0; border-radius: 8px; background: var(--blue);
         color: #fff; font-weight: 600; cursor: pointer; }
button.secondary { background: #e8eef8; color: var(--blue); }
.login { max-width: 380px; margin: 40px auto; display: grid; gap: 12px; }

@media (max-width: 520px) {
  .light { padding: 16px 4px; font-size: .85rem; }
  .light .count { font-size: 2.2rem; }
  .figures dd { font-size: 1.1rem; }
  .top { padding: 12px 16px; }
  .brand { gap: 10px; }
  .brand img { height: 60px; }
  .logo-ocean { width: 60px; }
  .logo-nvl { width: 99px; }
  .brand-title { font-size: 16px; order: 3; flex-basis: 100%; }
  .who { display: none; }
  .m-only-link { display: inline; }
}
