@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

:root {
  --gold: #c9a84c;
  --gold-bright: #e8c84a;
  --gold-dark: #a07e2f;
  --gold-glow: rgba(201, 168, 76, 0.25);
  --platinum: #e5e4e2;
  --platinum-light: #f0efed;
  --silver: #c0c0c0;
  --silver-dark: #8a8a8a;
  --charcoal: #1a1a2e;
  --charcoal-light: #232340;
  --charcoal-mid: #2a2a48;
  --surface: #1e1e36;
  --surface-raised: #26263f;
  --surface-hover: #2f2f50;
  --danger: #e74c5a;
  --danger-bg: rgba(231, 76, 90, 0.12);
  --success: #3ecf8e;
  --success-bg: rgba(62, 207, 142, 0.12);
  --warning: #f5a623;
  --warning-bg: rgba(245, 166, 35, 0.12);
  --text-primary: #f0efed;
  --text-secondary: #a9a9bc;
  --text-muted: #6e6e85;
  --border: rgba(201, 168, 76, 0.15);
  --border-strong: rgba(201, 168, 76, 0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-gold: 0 0 20px rgba(201, 168, 76, 0.1);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--charcoal);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(201, 168, 76, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(201, 168, 76, 0.04) 0%, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* --- HEADER --- */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
  padding: 20px 28px;
  background: linear-gradient(135deg, var(--charcoal-light) 0%, var(--surface) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md), var(--shadow-gold);
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-bright), var(--gold), transparent);
}

header h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--platinum-light) 0%, var(--gold) 50%, var(--platinum) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.badge {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-bright));
  color: var(--charcoal);
  padding: 3px 12px;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  -webkit-text-fill-color: var(--charcoal);
  border: none;
  box-shadow: 0 2px 8px rgba(201, 168, 76, 0.3);
}

.timestamp {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
  margin-top: 4px;
}

/* --- BUTTONS --- */

.btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--platinum);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--gold);
  color: var(--gold-bright);
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.15);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold), var(--gold-bright));
  color: var(--charcoal);
  border: none;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(201, 168, 76, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-bright), #f0d860);
  color: var(--charcoal);
  box-shadow: 0 4px 18px rgba(201, 168, 76, 0.45);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(231, 76, 90, 0.15);
  color: var(--danger);
  border-color: rgba(231, 76, 90, 0.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 4px 14px rgba(231, 76, 90, 0.35);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.btn-icon {
  padding: 5px 12px;
  font-size: 0.75rem;
  border-radius: var(--radius-xs);
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- CARDS --- */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--border-strong);
}

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

.card-header h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--platinum-light);
  letter-spacing: 0.01em;
}

.card-header .sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- FORMS --- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

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

.form-field label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--charcoal);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  transition: all var(--transition);
  outline: none;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.form-field input[readonly] {
  color: var(--text-muted);
  background: var(--surface-raised);
  cursor: default;
}

.form-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a9a9bc' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-field select option {
  background: var(--charcoal);
  color: var(--text-primary);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.required {
  color: var(--gold-bright);
  font-weight: 700;
}

.error-text {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 8px;
}

/* --- SEARCH ROW --- */

.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.search-row input {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--charcoal);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  transition: all var(--transition);
  outline: none;
}

.search-row input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.search-row input::placeholder {
  color: var(--text-muted);
}

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

/* --- TABLE --- */

.table-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-header {
  background: linear-gradient(135deg, var(--charcoal-mid) 0%, var(--charcoal-light) 100%);
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--border-strong);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid var(--border-strong);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody {
  display: block;
  max-height: 380px;
  overflow-y: auto;
}

tbody::-webkit-scrollbar {
  width: 6px;
}

tbody::-webkit-scrollbar-track {
  background: var(--charcoal);
}

tbody::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 3px;
}

thead, tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: var(--surface-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* --- TAGS AND PILLS --- */

.tag {
  display: inline-block;
  background: rgba(201, 168, 76, 0.12);
  color: var(--gold-bright);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border: 1px solid rgba(201, 168, 76, 0.2);
}

.pill-high {
  display: inline-block;
  background: var(--danger-bg);
  color: var(--danger);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid rgba(231, 76, 90, 0.2);
}

.pill-medium {
  display: inline-block;
  background: var(--warning-bg);
  color: var(--warning);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid rgba(245, 166, 35, 0.2);
}

.pill-low {
  display: inline-block;
  background: var(--success-bg);
  color: var(--success);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid rgba(62, 207, 142, 0.2);
}

/* --- EMPTY STATE --- */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.empty-state strong {
  color: var(--gold);
}

/* --- RESPONSIVE --- */

@media (max-width: 768px) {
  .app-shell {
    padding: 16px 12px;
  }

  header {
    padding: 16px 20px;
    flex-direction: column;
    align-items: flex-start;
  }

  header h1 {
    font-size: 1.3rem;
  }

  .card {
    padding: 16px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn-group {
    width: 100%;
  }

  .btn {
    flex: 1;
    text-align: center;
    padding: 10px 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .search-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.1rem;
    flex-wrap: wrap;
  }

  .badge {
    font-size: 0.65rem;
  }
}
