@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #edf1f6;
  --panel: #ffffff;
  --panel-soft: #f6f8fb;
  --border: #d5dde7;
  --text: #0f172a;
  --heading: #0b1f33;
  --muted: #5b6674;
  --accent: #0b3c5d;
  --accent-dark: #082a43;
  --accent-soft: #e4eef7;
  --warning-bg: #fff6e5;
  --warning-border: #f2c66d;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 4px 12px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'IBM Plex Sans', 'Source Sans 3', 'Trebuchet MS', sans-serif;
  background:
    radial-gradient(circle at 12% 18%, #e7eef7 0%, transparent 55%),
    radial-gradient(circle at 85% 0%, #eef4ff 0%, transparent 50%),
    linear-gradient(160deg, #f7f9fc 0%, #edf2f7 100%);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 20px 60px;
  position: relative;
  z-index: 1;
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.header-bar h1 {
  margin: 0;
  font-size: 1.7rem;
  color: var(--heading);
  letter-spacing: 0.2px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-ribbon {
  background: var(--accent);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.status-ribbon.status-actioned {
  background: #0f766e;
}

.status-ribbon.status-submitted {
  background: #1d4f91;
}

.status-ribbon.status-live {
  background: #0f3d2e;
}

.status-ribbon.status-needs-info {
  background: #b45309;
}

.status-ribbon.status-deleted {
  background: #64748b;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn,
button {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 6px 12px rgba(11, 60, 93, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover,
button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(11, 60, 93, 0.2);
}

.btn:focus-visible,
button:focus-visible {
  outline: 2px solid rgba(11, 60, 93, 0.35);
  outline-offset: 2px;
}

.btn-secondary {
  background: #425267;
  box-shadow: 0 6px 12px rgba(66, 82, 103, 0.2);
}

.btn-secondary:hover {
  background: #2f3c4d;
}

.btn-ghost {
  background: #e6edf5;
  color: var(--heading);
  box-shadow: none;
}

.btn-ghost:hover {
  background: #d6e0ec;
  box-shadow: none;
  transform: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--heading);
  box-shadow: none;
}

.btn-outline:hover {
  background: #eef2f7;
  border-color: #c6d1dd;
  box-shadow: none;
  transform: none;
}

.btn-danger {
  color: #ffffff;
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-danger:hover {
  background: #991b1b;
  border-color: #991b1b;
}

.btn-small {
  padding: 6px 10px;
  font-size: 0.85rem;
  box-shadow: none;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  justify-content: space-between;
  align-items: center;
}

.actions-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.autosave-status {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.filters .field {
  flex: 1 1 200px;
}

.filters .filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.notice {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: #7a4c00;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.lock-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lock-panel strong {
  display: block;
  margin-bottom: 4px;
}

.error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.small {
  font-size: 0.9rem;
  color: var(--muted);
}

.file-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.helper {
  margin-top: 4px;
}

details {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px 16px;
  margin-bottom: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

details summary {
  cursor: pointer;
  font-weight: 600;
  padding: 6px 0;
  color: var(--heading);
  letter-spacing: 0.2px;
}

details[open] summary {
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.form-grid .span-full {
  grid-column: 1 / -1;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--heading);
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(11, 60, 93, 0.2);
  border-color: var(--accent);
}

input.field-invalid,
textarea.field-invalid,
select.field-invalid {
  border-color: #dc2626;
  background: #fff5f5;
}

.field-error {
  margin-top: 4px;
  font-size: 0.85rem;
  color: #b91c1c;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input[type="file"] {
  font-size: 0.9rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-weight: 400;
  color: var(--muted);
}

.checkbox-row input {
  width: auto;
}

.checkbox-compact {
  margin-top: 0;
  font-size: 0.85rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border: 1px solid var(--border);
  padding: 10px;
  vertical-align: top;
}

th {
  background: var(--panel-soft);
  text-align: left;
  font-weight: 600;
  color: var(--heading);
}

tbody tr:hover {
  background: #f8fafc;
}

.actions-col {
  width: 110px;
  text-align: center;
}

.table-actions {
  display: flex;
  gap: 6px;
}

.table-actions form {
  margin: 0;
}

.inline-form {
  margin: 0;
}

.status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-draft {
  background: #e7edf5;
  color: #1f2933;
}

.status-needs-info {
  background: #ffedd5;
  color: #9a3412;
}

.status-submitted {
  background: #dcfce7;
  color: #166534;
}

.status-actioned {
  background: #dbeafe;
  color: #1e3a8a;
}

.status-live {
  background: #d1fae5;
  color: #065f46;
}

.status-deleted {
  background: #e2e8f0;
  color: #475569;
}

.status-row-deleted {
  background: #f8fafc;
  opacity: 0.7;
}

.due-date {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.due-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.due-overdue {
  background: #fee2e2;
  color: #991b1b;
}

.due-soon {
  background: #ffedd5;
  color: #9a3412;
}

.due-na {
  background: #e2e8f0;
  color: #475569;
}

.due-row-overdue {
  background: #fff5f5;
}

.due-row-soon {
  background: #fff9f0;
}

.list-table td,
.list-table th {
  font-size: 0.95rem;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.table-scroll table {
  min-width: 720px;
}

.sort-link {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sort-indicator {
  font-size: 0.75rem;
  color: var(--muted);
}

.footer-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination-links a,
.pagination-links span {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 0.9rem;
}

.pagination-links span {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.pagination-links .current {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

@media (max-width: 900px) {
  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filters .filter-actions {
    width: 100%;
  }

  .sticky-actions {
    position: sticky;
    top: 10px;
    z-index: 5;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 10px;
    box-shadow: var(--shadow-soft);
  }

  .autosave-status {
    width: 100%;
    text-align: left;
  }

  .lock-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-scroll {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .table-scroll table {
    min-width: 0;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-soft);
  }

  .responsive-table td {
    border: 0;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .responsive-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    text-transform: none;
  }

  .responsive-table .table-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .actions-col {
    width: auto;
  }

  th,
  td {
    font-size: 0.92rem;
  }
}

@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: #ffffff;
  }

  .card {
    box-shadow: none;
    border: 0;
    padding: 0;
  }
}
