/* Phase 1: Critical UI Fixes - Consistent Sizing & Alignment */

:root {
  --bg: #1c1c1e;
  --panel: #2c2c2e;
  --panel2: #3a3a3c;
  --border: #48484a;
  --text: #f5f5f7;
  --muted: #98989d;
  --link: #0a84ff;
  --ok: #30d158;
  --warn: #ff9f0a;
  --bad: #dc3545;
  
  /* PHASE 1 FIX #3: Consistent sizing variables */
  --btn-font: 13px;
  --btn-padding: 8px 16px;
  --heading-font: 15px;  /* Increased from 14px */
  --text-font: 13px;
  --note-font: 12px;  /* Smaller for notes/info text */
  --label-font: 13px;
  --table-font: 13px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: var(--text-font);
}

.wrap { max-width: 1600px; margin: 0 auto; padding: 20px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--panel);
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 32px; height: 32px; }

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

/* PHASE 1 FIX #3: Headings consistent */
h2 { font-size: var(--heading-font); font-weight: 600; }
h3 { font-size: var(--heading-font); font-weight: 600; }

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab {
  padding: 10px 16px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  font-size: var(--btn-font);
}

.tab:hover { color: var(--text); }
.tab.active {
  color: var(--link);
  border-bottom-color: var(--link);
}

/* PHASE 1 FIX #3 & #8: Consistent button sizing and alignment */






/* PHASE 1 FIX #8: Action buttons aligned horizontally */


input, select, textarea {
  width: 100%;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px;
  border-radius: 8px;
  font-size: var(--text-font);
  margin-top: 4px;
}

/* PHASE 1 FIX #7: Checkbox inline with label */
label {
  display: block;
  margin-top: 12px;
  font-weight: 500;
  font-size: var(--label-font);
  color: var(--muted);
}

label.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

label.inline input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* PHASE 1 FIX #3: Notes/info text sizing */
.note-text, .info-text {
  font-size: var(--note-font);
  color: var(--muted);
  margin-top: 6px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 12px;
  font-size: var(--table-font);
}

th {
  text-align: left;
  padding: 10px;
  background: var(--panel2);
  font-weight: 600;
  font-size: var(--label-font);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

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

/* PHASE 1 FIX #5: Inline dates helper class */
.inline-dates {
  display: flex;
  gap: 16px;
  align-items: center;
}

.date-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.date-col .label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}

.date-col .value {
  font-size: var(--text-font);
  color: var(--text);
}

/* Status pills */
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pill.ok { background: var(--ok); color: #000; }
.pill.warn { background: var(--warn); color: #000; }
.pill.bad { 
  background: var(--bad); 
  color: #000;
}

.flash {
  padding: 12px;
  margin-bottom: 16px;
  background: var(--panel2);
  border: 1px solid var(--link);
  border-radius: 8px;
  color: var(--link);
  font-size: var(--text-font);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

a {
  color: var(--link);
  text-decoration: none;
  font-size: var(--text-font);
}

a:hover { text-decoration: underline; }

/* Modal overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active { display: flex; }

/* Responsive */
@media (max-width: 1200px) {
  .inline-dates { flex-direction: column; align-items: flex-start; }
}

/* Force consistent button height and alignment */
.btn {
  background: var(--link);
  color: var(--text);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.2s;
  white-space: nowrap;
  display: inline-block;
  height: 36px;  /* Fixed height */
  line-height: 20px;  /* Vertical centering */
  box-sizing: border-box;
  vertical-align: middle;
}

.btn:hover { opacity: 0.8; }

.btn.secondary {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.danger {
  background: var(--bad);
  color: #000;
}

/* Ensure links styled as buttons also get same height */
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* Action button containers */
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
