/* ============================================
   LIAISON OS DASHBOARD — STYLES
   ============================================ */

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

:root {
  --bg:          #0a0c10;
  --bg-2:        #0f1117;
  --bg-3:        #141720;
  --bg-4:        #1a1f2e;
  --border:      rgba(255,255,255,0.07);
  --border-glow: rgba(59,130,246,0.25);
  --blue:        #3b82f6;
  --blue-light:  #60a5fa;
  --blue-dim:    rgba(59,130,246,0.15);
  --text:        #e2e8f0;
  --text-2:      #94a3b8;
  --text-3:      #64748b;
  --white:       #ffffff;
  --green:       #22c55e;
  --yellow:      #eab308;
  --red:         #ef4444;
  --orange:      #f97316;
  --radius:      12px;
  --radius-lg:   18px;
  --t:           0.2s ease;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
}

.hidden { display: none !important; }

/* ============================================
   LOGIN
   ============================================ */
#login-screen {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(59,130,246,0.1) 0%, transparent 70%),
    var(--bg);
}

.login-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--white);
}
.login-logo strong { font-weight: 800; }
.logo-mark { color: var(--blue); font-size: 1.5rem; line-height: 1; }

.login-card h1 { font-size: 1.6rem; font-weight: 700; color: var(--white); }
.login-sub { font-size: 0.875rem; color: var(--text-3); margin-top: -8px; }

#login-form { display: flex; flex-direction: column; gap: 12px; }

#pw-input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
#pw-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.login-error { font-size: 0.8rem; color: var(--red); min-height: 1em; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t);
  border: 1px solid transparent;
  font-family: inherit;
  white-space: nowrap;
}
.btn--sm  { padding: 6px 14px; font-size: 0.8rem; }
.btn--full { width: 100%; justify-content: center; padding: 13px; font-size: 1rem; }
.btn--primary { background: var(--blue); color: var(--white); }
.btn--primary:hover { background: var(--blue-light); box-shadow: 0 0 20px rgba(59,130,246,0.35); }
.btn--ghost { border-color: var(--border); color: var(--text-2); background: transparent; }
.btn--ghost:hover { color: var(--white); background: rgba(255,255,255,0.05); }

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10,12,16,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--white);
  text-decoration: none;
}
.topbar__logo strong { font-weight: 800; }
.topbar__logo em { font-style: normal; color: var(--text-3); font-weight: 400; font-size: 0.875rem; margin-left: 2px; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topbar__clock { font-size: 0.8rem; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ============================================
   DASHBOARD GRID
   ============================================ */
.dashboard {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 20px;
}

/* ============================================
   WIDGET
   ============================================ */
.widget {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color var(--t);
}
.widget:hover { border-color: rgba(255,255,255,0.12); }

.widget__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.widget__icon {
  width: 36px;
  height: 36px;
  background: var(--blue-dim);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-light);
  flex-shrink: 0;
}
.widget__icon svg { width: 18px; height: 18px; }

.widget__header h2 { font-size: 0.95rem; font-weight: 600; color: var(--white); }
.widget__sub { font-size: 0.75rem; color: var(--text-3); }

.widget__refresh {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  transition: color var(--t), background var(--t);
  flex-shrink: 0;
}
.widget__refresh:hover { color: var(--text-2); background: rgba(255,255,255,0.05); }
.widget__refresh svg { width: 14px; height: 14px; }
.widget__refresh.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.widget__body { padding: 20px; flex: 1; }

/* ============================================
   LOADING
   ============================================ */
.loading {
  display: flex;
  justify-content: center;
  padding: 32px;
}
.loading span {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: block;
}

/* ============================================
   AGENDA WIDGET
   ============================================ */
.agenda-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-3);
  font-size: 0.875rem;
}

.agenda-list { display: flex; flex-direction: column; gap: 8px; }

.agenda-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--t), background var(--t);
}
.agenda-item:hover { border-color: var(--border-glow); background: var(--bg-4); }

.agenda-item__date {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 40px;
  background: var(--blue-dim);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 8px;
  padding: 6px 4px;
}
.agenda-item__date .day { font-size: 1.1rem; font-weight: 700; color: var(--blue-light); line-height: 1; }
.agenda-item__date .month { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }

.agenda-item__date.today { background: var(--blue); border-color: var(--blue); }
.agenda-item__date.today .day,
.agenda-item__date.today .month { color: var(--white); }

.agenda-item__info { flex: 1; min-width: 0; }
.agenda-item__title { font-size: 0.9rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-item__time { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }

.agenda-item__cat {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 500;
  background: rgba(59,130,246,0.1);
  color: var(--blue-light);
  border: 1px solid rgba(59,130,246,0.2);
  white-space: nowrap;
  align-self: center;
}

/* ============================================
   INVOICES WIDGET
   ============================================ */
.invoice-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.invoice-stat {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.invoice-stat__num { font-size: 1.25rem; font-weight: 700; color: var(--white); }
.invoice-stat__label { font-size: 0.7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.invoice-stat--open .invoice-stat__num { color: var(--yellow); }
.invoice-stat--paid .invoice-stat__num { color: var(--green); }

.invoice-list { display: flex; flex-direction: column; gap: 6px; }

.invoice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.invoice-row__num { font-weight: 600; color: var(--white); min-width: 80px; font-size: 0.8rem; }
.invoice-row__customer { flex: 1; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invoice-row__amount { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.invoice-row__date { font-size: 0.75rem; color: var(--text-3); min-width: 72px; text-align: right; }

.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.status-badge--draft    { background: rgba(100,116,139,0.2); color: #94a3b8; border: 1px solid rgba(100,116,139,0.3); }
.status-badge--sent     { background: rgba(234,179,8,0.15);  color: #eab308; border: 1px solid rgba(234,179,8,0.25); }
.status-badge--paid     { background: rgba(34,197,94,0.15);  color: #22c55e; border: 1px solid rgba(34,197,94,0.25); }
.status-badge--overdue  { background: rgba(239,68,68,0.15);  color: #ef4444; border: 1px solid rgba(239,68,68,0.25); }

/* ============================================
   WEATHER WIDGET
   ============================================ */
.weather-main {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.weather-icon { font-size: 4rem; line-height: 1; }

.weather-temp {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.weather-temp__value { font-size: 3rem; font-weight: 700; color: var(--white); line-height: 1; }
.weather-temp__feels { font-size: 0.8rem; color: var(--text-3); }
.weather-desc { font-size: 1rem; color: var(--text-2); margin-top: 4px; }

.weather-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.weather-detail {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.weather-detail svg { width: 16px; height: 16px; color: var(--blue-light); flex-shrink: 0; }
.weather-detail__label { font-size: 0.7rem; color: var(--text-3); }
.weather-detail__value { font-size: 0.95rem; font-weight: 600; color: var(--text); }

.weather-forecast {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.forecast-day {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
}
.forecast-day__name { color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.65rem; }
.forecast-day__icon { font-size: 1.2rem; }
.forecast-day__temp-hi { font-weight: 600; color: var(--text); font-size: 0.8rem; }
.forecast-day__temp-lo { color: var(--text-3); font-size: 0.7rem; }
.forecast-day.today { border-color: var(--border-glow); background: var(--bg-4); }

/* ============================================
   SHORTCUTS WIDGET
   ============================================ */
.shortcuts-grid { display: flex; flex-direction: column; gap: 10px; }

.shortcut-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color var(--t), background var(--t), transform var(--t);
}
.shortcut-btn:hover {
  border-color: var(--border-glow);
  background: var(--bg-4);
  transform: translateX(3px);
}
.shortcut-btn--active { border-color: rgba(59,130,246,0.3); background: rgba(59,130,246,0.05); }

.shortcut-btn__icon {
  width: 36px;
  height: 36px;
  background: var(--blue-dim);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-light);
  flex-shrink: 0;
}
.shortcut-btn__icon svg { width: 16px; height: 16px; }

.shortcut-btn__text { flex: 1; }
.shortcut-btn__text strong { display: block; font-size: 0.9rem; color: var(--white); font-weight: 600; }
.shortcut-btn__text span  { display: block; font-size: 0.75rem; color: var(--text-3); }

.shortcut-btn__arrow { width: 14px; height: 14px; color: var(--text-3); flex-shrink: 0; }
.shortcut-btn__badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(59,130,246,0.2);
  color: var(--blue-light);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================
   ERROR STATE
   ============================================ */
.widget-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  color: var(--text-3);
  font-size: 0.875rem;
  text-align: center;
}
.widget-error svg { width: 24px; height: 24px; color: var(--text-3); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }
  .weather-forecast { grid-template-columns: repeat(4, 1fr); }
  .weather-forecast .forecast-day:nth-child(n+5) { display: none; }
}

@media (max-width: 480px) {
  .login-card { padding: 32px 24px; }
  .invoice-summary { grid-template-columns: 1fr 1fr; }
  .invoice-row__date { display: none; }
  .weather-forecast { grid-template-columns: repeat(3, 1fr); }
  .weather-forecast .forecast-day:nth-child(n+4) { display: none; }
}
