@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #F5F4F0;
  --panel: #FFFFFF;
  --ink: #1C2B39;
  --ink-soft: #4B5A67;
  --accent: #4C7A73;
  --accent-ink: #2E4B47;
  --alert: #B5561F;
  --alert-bg: #FBEDE4;
  --border: #D9D7CF;
  --sidebar-bg: #1C2B39;
  --sidebar-ink: #C9D2D8;
  --sidebar-ink-dim: #7C8A96;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.mono {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.92em;
}

/* ---- Authenticated shell ---- */

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

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
}

.brand-mark {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 13px;
  background: var(--accent);
  color: #fff;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.brand-name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.25;
  color: #fff;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
  flex: 1;
}

.nav a {
  color: var(--sidebar-ink);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav a:hover:not(.disabled) { background: rgba(255,255,255,0.06); }

.nav a.active {
  background: var(--accent);
  color: #fff;
}

.nav a.disabled {
  color: var(--sidebar-ink-dim);
  cursor: default;
  pointer-events: none;
}

.nav .tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3px;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 1px 5px;
  border-radius: 2px;
  color: var(--sidebar-ink-dim);
}

.sidebar-footer {
  padding: 16px 20px 0 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.who-name { font-size: 13px; font-weight: 600; color: #fff; }
.who-role {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--sidebar-ink-dim);
  text-transform: lowercase;
}

.logout {
  color: var(--sidebar-ink-dim);
  font-size: 12px;
  text-decoration: none;
}
.logout:hover { color: #fff; }

.content {
  flex: 1;
  padding: 40px 48px;
  max-width: 920px;
}

.page-header { margin-bottom: 28px; }
.page-header h1 { margin: 0 0 4px 0; font-size: 24px; font-weight: 700; }
.page-sub { margin: 0; color: var(--ink-soft); font-size: 14px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 20px;
}

.panel h2 {
  margin: 0 0 16px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-table { width: 100%; border-collapse: collapse; }
.status-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.status-table tr:last-child td { border-bottom: none; }
.status-table td:last-child { text-align: right; width: 140px; }

.status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 2px;
  letter-spacing: 0.03em;
}
.status-live { background: #E6EEEC; color: var(--accent-ink); }
.status-pending { background: #EFEEEA; color: var(--ink-soft); }

/* ---- Search forms (recordings / faxes / audit log) ---- */

.search-form {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.search-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.search-field input,
.search-field select {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}

.search-field input:focus,
.search-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76,122,115,0.15);
}

.search-submit button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.search-submit button:hover { background: var(--accent-ink); }

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.results-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--border);
}

.results-table td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.results-table audio {
  height: 32px;
  max-width: 220px;
}

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: #EFEEEA;
  color: var(--ink-soft);
}

.pill-in { background: #E6EEEC; color: var(--accent-ink); }
.pill-out { background: var(--alert-bg); color: var(--alert); }

.empty-state {
  color: var(--ink-soft);
  font-size: 14px;
  padding: 12px 0;
}

/* ---- Fax send form ---- */

.fax-compose {
  padding: 28px 28px 32px;
}

.fax-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 680px;
}

.fax-grid {
  display: grid;
  grid-template-columns: 1.3fr 1.3fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .fax-grid { grid-template-columns: 1fr; }
}

.fax-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fax-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field-hint {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--sidebar-ink-dim);
}

.fax-field input[type="text"],
.fax-field input[type="date"],
.fax-field textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  resize: vertical;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.fax-field input:focus,
.fax-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76,122,115,0.15);
}

.fax-field input::placeholder,
.fax-field textarea::placeholder {
  color: #9AA6AD;
}

/* Custom select: hide native chrome, draw our own chevron so it matches
   across browsers/OSes instead of falling back to whatever the platform draws. */
.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 1.6px solid var(--ink-soft);
  border-bottom: 1.6px solid var(--ink-soft);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 34px 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.select-wrap select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76,122,115,0.15);
}

/* Custom file picker: the native control renders inconsistently and looks
   dated, so the real <input type=file> is visually hidden and this styled
   label acts as the control; the label's `for` keeps it keyboard/click accessible. */
.file-drop-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.file-drop {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  cursor: pointer;
  background: #FBFAF8;
  transition: border-color 120ms ease, background 120ms ease;
}

.file-drop:hover {
  border-color: var(--accent);
  background: #F5F9F8;
}

.file-drop:has(.file-drop-input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.file-drop-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-drop-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.file-drop-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-drop-sub {
  font-size: 12px;
  color: var(--sidebar-ink-dim);
}

.file-drop--chosen {
  border-style: solid;
  border-color: var(--accent);
  background: #F5F9F8;
}

.file-drop--chosen .file-drop-icon {
  background: var(--accent-ink);
}

.fax-submit {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 11px 24px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 4px;
  transition: background 120ms ease, transform 80ms ease;
}

.fax-submit:hover { background: var(--accent-ink); }
.fax-submit:active { transform: translateY(1px); }

/* ---- Login screen (unauthenticated) ---- */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  padding: 24px;
}

.login-panel {
  background: var(--panel);
  border-radius: 6px;
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}

.login-mark {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 13px;
  background: var(--accent);
  color: #fff;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  margin-bottom: 20px;
}

.login-panel h1 {
  font-size: 19px;
  margin: 0 0 6px 0;
}

.login-sub {
  color: var(--ink-soft);
  font-size: 13.5px;
  margin: 0 0 24px 0;
}

.login-form { display: flex; flex-direction: column; gap: 6px; }

.login-form label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 10px;
}

.login-form input {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76,122,115,0.15);
}

.login-form button {
  margin-top: 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.login-form button:hover { background: var(--accent-ink); }

.alert {
  background: var(--alert-bg);
  color: var(--alert);
  border: 1px solid rgba(181,86,31,0.25);
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 4px;
}

/* ---- Microsoft sign-in (login screen) ---- */

.ms-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease;
}

.ms-signin-btn:hover { background: var(--bg); border-color: var(--ink-soft); }

.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--ink-soft);
  font-size: 12px;
  margin: 18px 0;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.login-divider span { padding: 0 10px; }

/* ---- Inline text-link buttons (e.g. Manage Staff row actions) ---- */

.link-button {
  background: none;
  border: none;
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.link-button:hover { color: var(--alert); }

/* Accessibility: visible focus ring app-wide */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
