* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
:root {
  --bg: #0f1419;
  --surface: #1c2630;
  --surface-hover: #263340;
  --border: #334455;
  --text: #e4e8ec;
  --text-muted: #8899aa;
  --accent: #d4a855;
  --accent-dim: #3d3020;
  --danger: #ef4444;
  --success: #4ade80;
  --info: #60a5fa;
  --warning: #f59e0b;
  --purple: #a78bfa;
  --pink: #f472b6;
  --teal: #2dd4bf;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0.75rem;
  -webkit-tap-highlight-color: transparent;
}
.app {
  max-width: 1200px;
  margin: 0 auto;
}
header {
  text-align: center;
  padding: 1rem 0 0.5rem;
}
header h1 {
  font-size: 1.6rem;
  color: var(--accent);
}
.subtitle {
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-size: 0.85rem;
}
.sync-status {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  min-height: 1em;
}
.controls {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}
.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  touch-action: manipulation;
}
.btn-add {
  background: var(--accent);
  color: #1a1a1a;
}
.btn-add:hover {
  background: #e0b866;
}
.btn-cancel {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-save {
  background: var(--accent);
  color: #1a1a1a;
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  font-size: 0.75rem;
  padding: 0.35rem 0.6rem;
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}
.btn-edit {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  padding: 0.35rem 0.6rem;
}
.btn-edit:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.hidden {
  display: none !important;
}

/* Company cards - grid */
.companies {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}
.company-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.company-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.company-card.status-interviewing::before {
  background: var(--purple);
}
.company-card.status-applied::before {
  background: var(--warning);
}
.company-card.status-researching::before {
  background: var(--info);
}
.company-card.status-offer::before {
  background: var(--success);
}
.company-card.status-rejected::before {
  background: var(--danger);
}
.company-card.status-declined::before {
  background: var(--text-muted);
}
.company-card:hover {
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.company-card-name {
  font-size: 1.1rem;
  font-weight: 700;
}
.company-card-role {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}
.company-card-meta {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}
.status-badge {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}
.status-badge.researching {
  background: #1e3a5f;
  color: #60a5fa;
}
.status-badge.applied {
  background: #3b2f1a;
  color: #fbbf24;
}
.status-badge.interviewing {
  background: #2d1b4e;
  color: #a78bfa;
}
.status-badge.offer {
  background: #1a3d2a;
  color: #4ade80;
}
.status-badge.rejected {
  background: #3d1a1a;
  color: #f87171;
}
.status-badge.declined {
  background: #2a2a2a;
  color: #888;
}
.company-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.section-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.15rem 0.5rem;
  border-radius: 8px;
}

/* Detail panel */
.detail-panel {
  margin-top: 0;
}
.detail-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.detail-back {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.4rem 0;
  touch-action: manipulation;
}
.detail-back:hover {
  text-decoration: underline;
}
.detail-actions {
  display: flex;
  gap: 0.4rem;
}

/* Hero card */
.detail-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}
.detail-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.detail-hero.status-interviewing::before {
  background: var(--purple);
}
.detail-hero.status-applied::before {
  background: var(--warning);
}
.detail-hero.status-researching::before {
  background: var(--info);
}
.detail-hero.status-offer::before {
  background: var(--success);
}
.detail-hero.status-rejected::before {
  background: var(--danger);
}
.detail-hero.status-declined::before {
  background: var(--text-muted);
}
.hero-name {
  font-size: 1.5rem;
  font-weight: 700;
}
.hero-role {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.hero-meta {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}
.hero-link {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
}
.hero-link:hover {
  text-decoration: underline;
}

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  align-items: start;
}

/* Widget cards */
.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  transition: all 0.2s;
  min-width: 0;
}
.widget:hover {
  border-color: #445566;
}
.widget-full {
  grid-column: 1/-1;
}
.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}
.widget-icon {
  font-size: 1rem;
  margin-right: 0.5rem;
}
.widget-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
}
.widget-actions {
  display: flex;
  gap: 0.25rem;
}
.widget-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0.4;
  transition: opacity 0.2s;
  padding: 0.25rem;
  touch-action: manipulation;
}
.widget-actions button:hover {
  opacity: 1;
}
.widget-body {
  padding: 0.85rem 1rem;
  max-height: 400px;
  overflow-y: auto;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-muted);
  white-space: pre-wrap;
}
.widget-body::-webkit-scrollbar {
  width: 4px;
}
.widget-body::-webkit-scrollbar-track {
  background: transparent;
}
.widget-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Widget color accents */
.widget-jd .widget-header {
  border-left: 3px solid var(--info);
}
.widget-product .widget-header {
  border-left: 3px solid var(--teal);
}
.widget-skills .widget-header {
  border-left: 3px solid var(--success);
}
.widget-talking .widget-header {
  border-left: 3px solid var(--accent);
}
.widget-questions .widget-header {
  border-left: 3px solid var(--purple);
}
.widget-culture .widget-header {
  border-left: 3px solid var(--pink);
}
.widget-compensation .widget-header {
  border-left: 3px solid var(--warning);
}
.widget-notes .widget-header {
  border-left: 3px solid var(--text-muted);
}

.widget-jd .widget-title {
  color: var(--info);
}
.widget-product .widget-title {
  color: var(--teal);
}
.widget-skills .widget-title {
  color: var(--success);
}
.widget-talking .widget-title {
  color: var(--accent);
}
.widget-questions .widget-title {
  color: var(--purple);
}
.widget-culture .widget-title {
  color: var(--pink);
}
.widget-compensation .widget-title {
  color: var(--warning);
}
.widget-notes .widget-title {
  color: var(--text-muted);
}

/* Add widget button */
.add-widget {
  grid-column: 1/-1;
  background: none;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  touch-action: manipulation;
}
.add-widget:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h2 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}
.modal label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.modal input,
.modal select,
.modal textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  grid-column: 1/-1;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .widget-full {
    grid-column: 1;
  }
  .companies {
    grid-template-columns: 1fr;
  }
  body {
    padding: 0.4rem;
  }
  .modal {
    padding: 1.25rem;
    border-radius: 8px;
    max-height: 95vh;
  }
  header h1 {
    font-size: 1.4rem;
  }
}
@media (min-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
