/* Service Reports — base styles */

:root {
  --ink: #1b2430;
  --ink-soft: #5b6675;
  --line: #e3e7ec;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --brand: #1f6f5c;
  --brand-dark: #16524444;
  --brand-dark: #154f41;
  --brand-soft: #e7f2ee;
  --amber: #b3791d;
  --amber-soft: #fcf1de;
  --blue: #2b5e9e;
  --blue-soft: #e8f0fb;
  --red: #b3392c;
  --red-soft: #fbe9e6;
  --gray-soft: #eef0f2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 40, 0.06), 0 1px 1px rgba(20,30,40,0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: #15201d;
  color: #d8e3df;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar .brand {
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  padding: 0 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
  flex: 1;
}

.sidebar .brand span {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: #8fa39b;
  margin-top: 2px;
}

/* Hamburger button — hidden on desktop, shown only on mobile (see breakpoint) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #d8e3df;
  border-radius: 2px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-panel { display: flex; flex-direction: column; flex: 1; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c4d2cd;
  padding: 12px 20px;
  font-size: 14px;
  border-left: 3px solid transparent;
}

.sidebar nav a:hover {
  background: rgba(255,255,255,0.05);
  text-decoration: none;
}

.sidebar nav a.active {
  background: rgba(255,255,255,0.08);
  border-left-color: #4fa98a;
  color: #fff;
  font-weight: 600;
}

.sidebar .user-box {
  margin-top: auto;
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
}

.sidebar .user-box .role {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(79,169,138,0.18);
  color: #7fd0b3;
  padding: 1px 7px;
  border-radius: 4px;
  margin-top: 4px;
}

.sidebar .user-box form { margin-top: 8px; }

.sidebar .user-box button {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: #d8e3df;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.sidebar .user-box button:hover { background: rgba(255,255,255,0.08); }

/* Main content */
.main {
  flex: 1;
  padding: 28px 36px 60px;
  max-width: 1180px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 10px;
}

.page-header h1 {
  font-size: 22px;
  margin: 0 0 4px;
}

.page-header p.sub {
  color: var(--ink-soft);
  margin: 0;
  font-size: 13.5px;
}

.header-actions { display: flex; gap: 10px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--gray-soft); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { color: var(--red); border-color: #eccac4; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .num { font-size: 24px; font-weight: 700; }
.stat .label { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

/* Tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -2px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #fafbfb; }
td { white-space: nowrap; }
td.wrap { white-space: normal; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-green { background: var(--brand-soft); color: var(--brand-dark); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-gray { background: var(--gray-soft); color: var(--ink-soft); }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #33424d; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 80px; }
.field { margin-bottom: 14px; }
.actions-row { display: flex; gap: 10px; margin-top: 18px; }

/* Filters bar */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.filters .field { margin-bottom: 0; min-width: 150px; }

/* Flash messages */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.flash-success { background: var(--brand-soft); color: var(--brand-dark); }
.flash-error { background: var(--red-soft); color: var(--red); }

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #15201d, #1f6f5c);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 36px 34px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-card h1 { font-size: 19px; margin: 0 0 4px; }
.login-card p { color: var(--ink-soft); font-size: 13px; margin: 0 0 22px; }
.login-card .field { margin-bottom: 14px; }
.login-card button { width: 100%; margin-top: 6px; justify-content: center; }
.login-hint { font-size: 12px; color: var(--ink-soft); margin-top: 16px; text-align: center; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-soft); }

.photo-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
.photo-thumb { width: 140px; }
.photo-thumb img,
.photo-grid img { width: 140px; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.photo-thumb form { margin-top: 6px; }

.text-muted { color: var(--ink-soft); }
.report-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; font-size: 14px; margin-bottom: 18px; }
.report-meta div span { display: block; font-size: 11.5px; text-transform: uppercase; color: var(--ink-soft); letter-spacing: 0.03em; }

@media print {
  .no-print { display: none !important; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; }
}

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; padding: 0; }
  .sidebar-top { padding: 12px 16px; }
  .sidebar .brand { padding: 0; border-bottom: none; margin-bottom: 0; font-size: 16px; }
  .sidebar .brand span { display: none; } /* tagline hidden in the compact mobile bar */

  .nav-toggle { display: flex; }

  /* Collapsed by default on mobile; JS toggles the .open class */
  .nav-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
  }
  .nav-panel.open {
    max-height: 75vh;
    overflow-y: auto;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .sidebar nav a { padding: 14px 20px; font-size: 15px; }

  .main { padding: 20px 18px 50px; max-width: none; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .report-meta { grid-template-columns: 1fr; }
  .page-header { align-items: flex-start; }
}

@media (max-width: 560px) {
  html, body { font-size: 15.5px; }
  .main { padding: 16px 14px 46px; }
  .card { padding: 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat .num { font-size: 21px; }

  /* Filters stack full-width and become easier to tap */
  .filters { flex-direction: column; align-items: stretch; padding: 14px; }
  .filters .field { min-width: 0; width: 100%; }
  .filters > .field[style] { width: 100% !important; }

  /* Bigger touch targets, and 16px inputs prevent iOS auto-zoom-on-focus */
  .btn { padding: 10px 16px; font-size: 14.5px; }
  .btn-sm { padding: 7px 12px; font-size: 13px; }
  input, select, textarea { padding: 11px 12px; font-size: 16px; }
  label { font-size: 13.5px; }

  .actions-row { flex-direction: column; }
  .actions-row .btn { width: 100%; justify-content: center; }

  .page-header { flex-direction: column; align-items: stretch; }
  .page-header .btn { width: 100%; justify-content: center; }
  .header-actions { flex-direction: column; width: 100%; }

  table { font-size: 13.5px; }
  th, td { padding: 9px 10px; }

  /* Photo thumbnails reflow to fit narrow screens instead of a fixed 140px */
  .photo-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)) !important; }
  .photo-grid > div, .photo-grid > a { width: 100% !important; }
  .photo-grid img { width: 100% !important; height: 105px !important; }

  .login-card { padding: 28px 22px; }
}
