/* Employee Emergency Contact Card System — simple, readable layout */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1a1d21;
  --muted: #5c6370;
  --border: #dde1e6;
  --accent: #1b5e7a;
  --accent-hover: #144a61;
  --danger: #b42318;
  --danger-bg: #fde8e6;
  --success-bg: #e3f5e8;
  --success-text: #0d5c2e;
  --error-bg: #fde8e6;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-size: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2.5rem;
}

header.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

header.site-header .inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.site-title a {
  color: var(--text);
  text-decoration: none;
}

.site-title a:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  font-size: 0.95rem;
}

.btn {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.25;
}

.btn:hover {
  border-color: var(--muted);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-danger {
  background: var(--danger-bg);
  border-color: #f5c4c0;
  color: var(--danger);
}

.btn-danger:hover {
  background: #fcc;
  border-color: #eaa;
  color: var(--danger);
}

.btn-small {
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
}

.flash-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem 0;
}

.flash {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.flash.success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid #b8e0c4;
}

.flash.error {
  background: var(--error-bg);
  color: var(--danger);
  border: 1px solid #f5c4c0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.toolbar form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  min-width: 200px;
}

label.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

input[type="text"],
input[type="tel"],
input[type="file"],
select,
textarea {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  width: 100%;
  max-width: 100%;
}

input[type="text"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(27, 94, 122, 0.35);
  outline-offset: 1px;
}

.search-input {
  flex: 1;
  min-width: 160px;
  max-width: 320px;
}

.sort-select {
  width: auto;
  min-width: 10rem;
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

table.list {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table.list th,
table.list td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.list th {
  font-weight: 600;
  background: #fafbfc;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

table.list tr:last-child td {
  border-bottom: none;
}

table.list .actions {
  white-space: nowrap;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
}

/* Forms */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
  max-width: 640px;
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}

.field {
  margin-bottom: 0.85rem;
}

.field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.field .hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.required {
  color: var(--danger);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* Emergency contact card (detail) */
.card-page {
  max-width: 720px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.emergency-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  gap: 1.25rem;
  padding: 1.35rem;
  background: linear-gradient(135deg, #e8f2f6 0%, #f8fafb 100%);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.card-photo {
  flex-shrink: 0;
}

.card-photo img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 14px;
  border: 3px solid #fff;
  box-shadow: var(--shadow);
  background: #e8eaed;
}

.card-title-block h1 {
  margin: 0 0 0.25rem;
  font-size: 1.45rem;
  line-height: 1.2;
}

.card-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card-body {
  padding: 1.25rem 1.35rem 1.5rem;
}

.card-block {
  margin-bottom: 1.35rem;
}

.card-block:last-child {
  margin-bottom: 0;
}

.card-block h2 {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.dl-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem 1rem;
}

@media (min-width: 520px) {
  .dl-grid.two-col {
    grid-template-columns: 140px 1fr;
  }
}

.dl-grid dt {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

.dl-grid dd {
  margin: 0;
  font-size: 0.95rem;
}

.dl-grid dt:nth-of-type(n + 2) {
  margin-top: 0.15rem;
}

/* Delete confirm */
.confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  max-width: 480px;
  box-shadow: var(--shadow);
}

.confirm-box p {
  margin-top: 0;
}

/* Print */
@media print {
  body {
    background: #fff;
  }

  .no-print,
  header.site-header,
  .flash-wrap,
  .card-actions {
    display: none !important;
  }

  .wrap {
    padding: 0;
    max-width: none;
  }

  .emergency-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .card-photo img {
    width: 3in;
    height: 3in;
    max-width: 100%;
    border-radius: 12px;
  }

  a {
    color: #000;
    text-decoration: none;
  }
}
