:root {
  --ink: #17212b;
  --muted: #667381;
  --line: #d9e1e8;
  --bg: #f3f6f8;
  --panel: #fff;
  --blue: #174f78;
  --green: #21765d;
  --red: #9a3d36;
  --amber: #a96500;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.logo { width: 118px; height: auto; display: block; }
.topbar span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.app-shell { padding: 16px 16px 86px; max-width: 980px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

.hero {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 22px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(23,79,120,.18), rgba(23,33,43,.72)),
    url("assets/builtin-site-bg.jpg") center / cover;
  border-radius: 8px;
}

h1 { margin: 0; font-size: 26px; line-height: 1.15; }
p { margin: 6px 0 0; color: var(--muted); line-height: 1.35; }
.hero p { color: rgba(255,255,255,.86); }

.landing-shell {
  max-width: 1120px;
}

.landing-hero {
  min-height: 320px;
  display: flex;
  align-items: flex-end;
  padding: 28px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(23,79,120,.12), rgba(23,33,43,.78)),
    url("assets/builtin-site-bg.jpg") center / cover;
  border-radius: 8px;
}

.landing-hero h1 {
  margin-top: 12px;
  font-size: clamp(34px, 6vw, 68px);
}

.landing-hero p {
  max-width: 700px;
  color: rgba(255,255,255,.88);
  font-size: 17px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.portal-card {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(23,33,43,.07);
}

.portal-card b {
  display: block;
  font-size: 20px;
}

.portal-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.4;
}

.form-note {
  min-height: 20px;
  margin-top: 8px;
  color: var(--red);
  font-size: 13px;
}

.panel,
.card,
.work-card,
.module-card {
  margin-top: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(23,33,43,.07);
}

label { display: block; margin-top: 12px; font-size: 13px; color: var(--muted); }
.input, textarea, select {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea { min-height: 96px; resize: vertical; }

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.primary { width: 100%; margin-top: 16px; color: #fff; background: var(--blue); }
.ghost, .back { padding: 0 12px; color: var(--blue); background: #fff; border: 1px solid #b8c7d4; }
.back { margin-bottom: 14px; }

.section-head,
.work-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.work-list { display: grid; gap: 12px; margin-top: 14px; }
.work-card { text-align: left; width: 100%; }
.work-card strong { display: block; margin: 4px 0; font-size: 18px; }
.work-card small { color: var(--muted); }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--blue);
  background: #e5eef4;
  font-size: 12px;
  font-weight: 700;
}
.tag.green { color: var(--green); background: #dff3e8; }
.tag.red { color: var(--red); background: #f7e4e1; }
.tag.amber { color: var(--amber); background: #fff0d8; }

.progress-ring {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) var(--pct, 0%), #dfe7ed 0);
  font-weight: 800;
}
.progress-ring span {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  font-size: 13px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.metrics div {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.metrics span { display: block; color: var(--muted); font-size: 12px; }
.metrics strong { display: block; margin-top: 4px; font-size: 15px; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.module-grid button {
  min-height: 96px;
  padding: 14px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
}
.module-grid b, .module-grid small { display: block; }
.module-grid small { margin-top: 6px; color: var(--muted); font-weight: 400; }

.row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row b { display: block; }
.row small { color: var(--muted); }

.inline-form {
  margin-top: 14px;
  padding-top: 2px;
}

.photo-preview {
  margin-top: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: #f3f6f8;
  border: 1px dashed var(--line);
  border-radius: 6px;
  font-size: 13px;
}

.row-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.row-actions button {
  flex: 1;
}

.danger {
  color: var(--red);
  border-color: #dfb5af;
}

.camera-box {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.camera-box video {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  background: #17212b;
  border-radius: 8px;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px max(12px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.tabbar button { color: var(--blue); background: transparent; }

@media (min-width: 760px) {
  .work-list { grid-template-columns: repeat(2, 1fr); }
  .tabbar { left: 50%; transform: translateX(-50%); max-width: 980px; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; }
}
