body {
  background: var(--c-bg);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 360px;
}

.login-box h1 {
  color: var(--c-navy);
  font-size: 1.3rem;
  margin-top: 0;
  text-align: center;
}

.login-box .field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}

.login-error {
  background: #fbe9e9;
  border: 1px solid #e3a9a9;
  color: var(--c-danger);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.login-success {
  background: #e6f3ea;
  border: 1px solid #a8d4b6;
  color: #216b3d;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.header-btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  margin-inline-start: 8px;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.header-btn-primary {
  background: var(--c-teal);
  color: #fff;
}

.header-btn-primary:hover {
  background: var(--c-navy);
}

.header-btn-outline {
  background: transparent;
  border: 1px solid var(--c-border);
  color: var(--c-navy);
}

.header-btn-outline:hover {
  background: var(--c-bg);
}

.header-btn-danger {
  background: #fbe9e9;
  color: var(--c-danger);
  border: 1px solid #e3a9a9;
}

.header-btn-danger:hover {
  background: #f7d9d9;
}

.header-btn-crm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.header-btn-crm img {
  display: block;
  border-radius: 4px;
}

.back-link {
  text-align: center;
  margin-top: 16px;
  font-size: 0.9rem;
}

.back-link a {
  color: var(--c-teal);
}

/* Dashboard */
.admin-header {
  background: var(--c-card);
  border-bottom: 1px solid var(--c-border);
  padding: 16px 0;
}

.admin-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-crm-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-crm-link img {
  display: block;
  border-radius: 4px;
}

.admin-header h1 {
  font-size: 1.2rem;
  color: var(--c-navy);
  margin: 0;
}

.admin-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}

.search-box {
  margin-inline-start: auto;
  padding: 8px 14px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.9rem;
  min-width: 220px;
}

.filter-btn {
  border: 1px solid var(--c-border);
  background: var(--c-card);
  color: var(--c-navy);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
}

.filter-btn.active {
  background: var(--c-navy);
  color: #fff;
  border-color: var(--c-navy);
}

.filter-btn .count {
  opacity: 0.75;
  font-weight: 400;
}

.summary-line {
  color: var(--c-muted);
  font-size: 0.88rem;
  margin-bottom: 14px;
}

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

table.subs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 980px;
}

table.subs-table th,
table.subs-table td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}

table.subs-table-compact th,
table.subs-table-compact td {
  padding: 4px 8px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

table.subs-table-compact .comments-cell,
table.subs-table-compact .note-input {
  max-width: 160px;
}

table.subs-table-compact .note-input {
  min-height: 0;
  height: 28px;
  resize: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

table.subs-table-compact .address-input,
table.subs-table-compact .preferred-time-input {
  width: 120px;
  padding: 4px 6px;
}

@media (max-width: 760px) {
  table.subs-table-compact {
    min-width: 640px;
    font-size: 0.78rem;
  }

  table.subs-table-compact th,
  table.subs-table-compact td {
    padding: 3px 6px;
    max-width: 110px;
  }

  table.subs-table-compact .comments-cell,
  table.subs-table-compact .note-input {
    max-width: 90px;
  }

  table.subs-table-compact .address-input,
  table.subs-table-compact .preferred-time-input {
    width: 80px;
  }
}

table.subs-table th {
  background: var(--c-bg);
  color: var(--c-navy);
  font-weight: 700;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

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

.cell-name {
  font-weight: 700;
  white-space: nowrap;
}

.cell-time {
  white-space: nowrap;
  color: var(--c-muted);
  font-size: 0.82rem;
}

.status-select {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--c-border);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
}

.status-select.status-new { color: #6b2d8c; background: #f1e6f7; }
.status-select.status-sent { color: #6b5416; background: #fdf6e8; }
.status-select.status-pending { color: #1f5a8c; background: #e8f1fb; }
.status-select.status-approved { color: #216b3d; background: #e6f3ea; }
.status-select.status-rejected { color: var(--c-danger); background: #fbe9e9; }

.note-input {
  width: 180px;
  min-height: 46px;
  padding: 6px 8px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.save-btn {
  background: var(--c-teal);
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
}

.save-btn:hover {
  background: var(--c-navy);
}

.save-btn.saved {
  background: #2e9150;
}

.delete-btn {
  background: var(--c-danger);
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
}

.delete-btn:hover {
  background: #8c2e2e;
}

.approved-time {
  white-space: nowrap;
  color: var(--c-muted);
  font-size: 0.8rem;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

.pagination-bar .filter-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

table.subs-table-compact tbody tr {
  cursor: pointer;
}

table.subs-table-compact tbody tr:hover {
  background: var(--c-bg);
}

.detail-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.detail-modal-overlay.open {
  display: flex;
}

.detail-modal {
  position: relative;
  background: var(--c-card);
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 24px;
}

.detail-modal-close {
  position: absolute;
  top: 10px;
  inset-inline-start: 14px;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--c-navy);
  cursor: pointer;
  padding: 4px 8px;
}

.detail-row {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  flex: 0 0 130px;
  font-weight: 700;
  color: var(--c-navy);
}

.detail-value {
  flex: 1;
  color: var(--c-text);
  white-space: pre-line;
  word-break: break-word;
}

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

.logout-link {
  color: var(--c-danger);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.phone-link {
  color: var(--c-teal);
  text-decoration: none;
  font-weight: 600;
}

.phone-link:hover {
  text-decoration: underline;
}

.comments-cell {
  max-width: 180px;
  white-space: pre-line;
  color: var(--c-muted);
  font-size: 0.82rem;
}
