:root {
  --primary: rgb(0, 172, 140);
  --primary-dark: rgb(0, 140, 114);
  --secondary: rgb(3, 64, 82);
  --bg: var(--secondary);
  --surface: #ffffff;
  --surface-2: #f4f6fb;
  --danger: #dc2626;
  --success: var(--primary);
  --text: var(--secondary);
  --text-muted: #4a6b75;
  --border: #cfe3df;
  --unit4: var(--primary);
  --unit2270: var(--secondary);
  --radius: 16px;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--surface-2);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

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

.topbar {
  background: var(--bg);
  color: white;
  padding: 14px 16px 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-weight: 700;
  font-size: 1.1rem;
  min-width: 0;
  text-align: right;
}

.company-logo {
  height: 18px;
  width: auto;
  max-width: 42vw;
  object-fit: contain;
  object-position: left center;
  /* Knock out the logo's black background against the dark top bar */
  mix-blend-mode: screen;
  flex-shrink: 0;
}

@media (min-width: 480px) {
  .company-logo {
    height: 22px;
  }
}

.tabs {
  display: flex;
  gap: 6px;
}

.tab {
  flex: 1;
  padding: 12px 8px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.95rem;
  font-weight: 600;
  border-bottom: 5px solid transparent;
  cursor: pointer;
}

.tab.active {
  color: white;
  border-bottom-color: var(--primary);
}

.content {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.view[hidden] {
  display: none;
}

.unit-title {
  text-align: center;
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.unit-sub {
  text-align: center;
  color: var(--text-muted);
  margin: 0 0 24px;
}

.checkin-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.checkin-hint {
  margin: 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.4;
  max-width: 28rem;
}

.search-wrap {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 16px 18px;
  font-size: 1.15rem;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 14px;
  outline: none;
  background: var(--surface-2);
}

.search-input:focus {
  border-color: var(--primary);
  background: white;
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  list-style: none;
  margin: 0;
  padding: 6px;
  z-index: 20;
  max-height: 220px;
  overflow-y: auto;
}

.suggestions[hidden] {
  display: none;
}

.suggestions li {
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.05rem;
}

.suggestions li:hover,
.suggestions li.highlighted {
  background: var(--surface-2);
}

.btn {
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 18px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:active {
  background: var(--primary-dark);
}

.btn-big {
  width: 100%;
  padding: 16px;
  font-size: 1.15rem;
}

.message {
  min-height: 1.2em;
  font-weight: 600;
  text-align: center;
  margin: 0;
}

.message.success {
  color: var(--success);
}

.message.error {
  color: var(--danger);
}

.present-list {
  margin-top: 28px;
}

.ooo-section h2,
.present-list h2,
.unit-card h2 {
  font-size: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 12px;
}

.all-header {
  position: relative;
  margin-bottom: 8px;
}

.all-header .unit-title,
.all-header .unit-sub {
  text-align: center;
}

.settings-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.settings-btn:hover {
  color: var(--text);
  border-color: #cbd5e1;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.modal-card {
  position: relative;
  background: white;
  border-radius: 18px;
  padding: 22px;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.modal-card-wide {
  max-width: 520px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.modal-card h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.modal-header h2 {
  margin: 0;
}

.modal-sub {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.modal-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  outline: none;
  margin-bottom: 10px;
}

.modal-input:focus {
  border-color: var(--primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
}

.btn-add {
  width: 100%;
  margin-top: 8px;
  border: 1px dashed var(--border);
  background: transparent;
}

.settings-people-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-people-list li {
  display: flex;
  gap: 8px;
  align-items: center;
}

.settings-people-list input {
  flex: 1;
  padding: 12px 14px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  outline: none;
}

.settings-people-list input:focus {
  border-color: var(--primary);
}

.settings-people-list .icon-btn.remove {
  flex-shrink: 0;
}

.people-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.people-list li {
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.person-name {
  font-weight: 600;
}

.person-since {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

.empty-note {
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 4px;
}

.units-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.unit-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.person-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  border: 1px solid var(--border);
  background: white;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

.icon-btn.move {
  color: var(--primary);
  border-color: rgba(0, 172, 140, 0.35);
}

.icon-btn.remove {
  color: var(--danger);
  border-color: #fecaca;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ooo-section {
  margin-top: 28px;
}

.ooo-list li {
  background: var(--surface-2);
  box-shadow: none;
  border: 1px dashed var(--border);
}

.ooo-list .person-name {
  color: var(--text-muted);
  font-weight: 500;
}

.visitor-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(3, 64, 82, 0.1);
  color: var(--secondary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
  text-transform: uppercase;
}

.role-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
  text-transform: uppercase;
}

.role-tag.role-fire {
  background: #fee2e2;
  color: #b91c1c;
}

.role-tag.role-fa {
  background: #dcfce7;
  color: #15803d;
}

.role-counts {
  margin: -4px 0 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.suggestions li.suggestion-visitor {
  color: var(--secondary);
  font-weight: 600;
}

.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 14px;
}

.dot-sep {
  margin: 0 6px;
}

@media (min-width: 640px) {
  .units-grid {
    flex-direction: row;
  }
  .unit-card {
    flex: 1;
  }
}
