/* ═══════════════════════════════════════════════════
   shared-ui.css  v19 — UI/UX Refresh
   ▸ Better typography & readability
   ▸ Cleaner layout (less clutter)
   ▸ Improved mobile/responsive
   ▸ Visual hierarchy polish
═══════════════════════════════════════════════════ */

:root {
  --font-body: "Noto Sans Thai", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Type scale — slightly larger base for readability */
  --text-xs:  0.72rem;
  --text-sm:  0.82rem;
  --text-md:  0.94rem;
  --text-lg:  1.08rem;
  --text-xl:  1.28rem;
  --text-2xl: 1.54rem;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 22px;
  --space-6: 28px;

  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-float: 0 8px 28px rgba(0, 0, 0, 0.22);
}

html { font-size: 15px; }

body {
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.6;
}

/* ── Top nav bar ── */
.top-projects {
  max-width: 1640px !important;
}

.top-projects-inner {
  gap: 8px !important;
}

/* Compact top-project tiles */
.top-project {
  min-height: 52px !important;
  padding: 8px 10px !important;
  border-radius: 10px !important;
  gap: 8px !important;
}

.top-project-icon {
  width: 30px !important;
  height: 30px !important;
  border-radius: 8px !important;
  font-size: 0.88rem !important;
}

.top-project-name {
  font-size: 0.8rem !important;
}

.top-project-desc,
.top-project-pill {
  font-size: var(--text-xs) !important;
}

/* ── Layout grid ── */
.layout {
  max-width: 1640px !important;
  gap: var(--space-4) !important;
}

@media (min-width: 820px) {
  .layout {
    grid-template-columns: 240px minmax(0, 1fr) !important;
  }
}

@media (min-width: 1140px) {
  .layout {
    grid-template-columns: 230px minmax(0, 1fr) 220px !important;
  }
}

/* ── Cards ── */
.card {
  padding: var(--space-4) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-card) !important;
}

/* ── Clock ── */
#clock {
  font-size: 2.4rem !important;
  letter-spacing: -0.5px;
}

/* ── Calendar ── */
.cal-day {
  min-height: 30px !important;
  font-size: 0.76rem !important;
  border-radius: 6px !important;
}

.cal-hint {
  font-size: 0.64rem !important;
  margin-top: 8px !important;
  opacity: 0.7;
}

/* ── Buttons ── */
.btn,
.theme-btn,
.today-btn,
.quick-tile,
.row-btn,
.graph-range-btn,
select,
input,
textarea {
  font-size: var(--text-sm) !important;
}

.btn,
.theme-btn {
  min-height: 36px !important;
  padding: 0 12px !important;
  border-radius: 8px !important;
}

.today-btn {
  min-height: 28px !important;
  padding: 2px 10px !important;
  font-size: 0.68rem !important;
}

/* Primary button accent */
.btn-primary {
  letter-spacing: 0.01em;
  font-weight: 700 !important;
}

/* ── Status pills ── */
.status-pill,
.date-badge,
.date-event,
.badge,
.progress-label,
.day-total-chip {
  font-size: var(--text-xs) !important;
}

/* ── Main header ── */
.main-header h1 {
  font-size: var(--text-xl) !important;
  line-height: 1.3 !important;
  font-weight: 700 !important;
}

/* ── App actions — hide noise, show clarity ── */
/* Collapse sync row visually */
.sync-row {
  gap: 6px !important;
}

.status-pill {
  min-height: 24px !important;
  padding: 2px 9px !important;
  font-size: 0.64rem !important;
}

/* ── Input row ── */
.input-row {
  gap: 8px !important;
  margin-bottom: var(--space-4) !important;
}

/* ── Tool / filter row ── */
.tool-row {
  gap: 8px !important;
  margin-bottom: var(--space-4) !important;
  grid-template-columns: minmax(0, 1fr) 148px !important;
}

/* ── Summary strip cards ── */
.summary-grid {
  gap: var(--space-3) !important;
  margin-bottom: var(--space-4) !important;
}

.summary-card {
  padding: 12px 14px !important;
  border-radius: 10px !important;
}

.summary-card span,
.field label,
thead th,
.budget-status,
.feature-head span {
  font-size: var(--text-xs) !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.summary-card strong {
  font-family: var(--font-mono);
  font-size: 1.3rem !important;
  letter-spacing: -0.3px;
}

.summary-card small,
.budget-amounts,
.mini-finance-meta,
.cal-hint,
.task-meta,
.notes-count,
.top-project-desc,
.top-project-pill {
  font-size: var(--text-xs) !important;
}

/* ── Task items ── */
.task-item {
  min-height: 48px !important;
  padding: 8px 12px !important;
  border-radius: 10px !important;
  margin-bottom: 6px !important;
  gap: 10px !important;
}

.task-text {
  font-size: 0.88rem !important;
  line-height: 1.45 !important;
}

/* ── Graph card ── */
.finance-graph-card {
  margin-bottom: var(--space-4) !important;
  border-radius: 12px !important;
}

.chart-shell {
  height: 200px !important;
}

.graph-range-btn {
  min-height: 28px !important;
  padding: 0 9px !important;
  font-size: 0.66rem !important;
  border-radius: 6px !important;
}

/* ── Right panel ── */
.right-panel {
  gap: var(--space-3) !important;
}

.feature-panel {
  padding: 10px 12px !important;
  border-radius: 10px !important;
}

.feature-head {
  margin-bottom: 10px !important;
}

.feature-head h2 {
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  letter-spacing: 0.01em;
}

.feature-head .btn {
  min-height: 28px !important;
  padding: 0 9px !important;
  font-size: 0.66rem !important;
}

/* ── Mini finance cards — handled in income-expense.html ── */

/* ── Status badges ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.done {
  color: var(--success);
  border-color: rgba(32, 180, 134, 0.32);
  background: rgba(32, 180, 134, 0.1);
}

.status-badge.waiting {
  color: var(--muted);
  background: var(--surface-3);
}

.status-badge.due {
  color: var(--warning);
  border-color: rgba(234, 179, 8, 0.34);
  background: rgba(234, 179, 8, 0.1);
}

.status-badge.overdue {
  color: var(--danger);
  border-color: rgba(240, 82, 98, 0.34);
  background: rgba(240, 82, 98, 0.1);
}

.btn-complete,
.btn:disabled {
  cursor: default !important;
  opacity: 0.65;
  transform: none !important;
}

/* ── Dashboard strip (4-up summary) ── */
.dashboard-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
}

.dash-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 12px 14px;
  transition: border-color 0.15s ease;
}

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

.dash-card span {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-card strong {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 1.12rem;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* ── Activity list ── */
.activity-list {
  display: grid;
}

.activity-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 8px 10px;
}

.activity-item strong {
  display: block;
  font-size: 0.8rem;
  line-height: 1.35;
}

.activity-item span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--text-xs);
}

/* ── Table polish ── */
th, td {
  padding: 10px 10px !important;
  font-size: 0.78rem !important;
}

thead th {
  font-size: 0.65rem !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.row-btn {
  min-width: 60px !important;
  min-height: 28px !important;
  font-size: 0.66rem !important;
  border-radius: 6px !important;
}

/* ── Progress bar ── */
.progress-wrap {
  height: 4px !important;
  margin-bottom: var(--space-4) !important;
}

/* ── Mobile overrides ── */
@media (max-width: 900px) {
  .dashboard-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  html { font-size: 14.5px; }

  .layout {
    gap: 10px !important;
  }

  .card {
    padding: 12px 14px !important;
  }

  .dashboard-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .dash-card {
    padding: 10px 12px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .tool-row {
    grid-template-columns: 1fr !important;
  }

  .input-row {
    gap: 6px !important;
  }

  .task-card {
    display: flex !important;
    flex-direction: column !important;
  }

  .task-card > .input-row {
    grid-template-columns: 1fr !important;
    order: -10 !important;
    margin-bottom: 10px !important;
  }

  .task-card > .input-row > input {
    min-width: 0 !important;
  }

  .task-card > .input-row > .btn {
    width: 100% !important;
  }

  .top-project-desc {
    display: none !important;
  }
}

@media (max-width: 420px) {
  .dashboard-strip {
    grid-template-columns: 1fr 1fr;
  }

  .main-header h1 {
    font-size: 1.1rem !important;
  }

  .summary-card strong {
    font-size: 1.1rem !important;
  }
}

/* ═══════════════════════════════════════════════════
   Mobile-first fixes (max-width: 640px)
   ▸ Hide "coming soon" nav tiles → no overflow
   ▸ Top nav always 2 columns on mobile
   ▸ Body padding tighter
═══════════════════════════════════════════════════ */

@media (max-width: 640px) {
  /* Force top nav to 2 columns and hide disabled tiles */
  .top-projects-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .top-project.disabled {
    display: none !important;
  }

  .top-project {
    min-height: 42px !important;
    padding: 7px 9px !important;
    gap: 7px !important;
  }

  .top-project-icon {
    width: 26px !important;
    height: 26px !important;
    font-size: 0.78rem !important;
  }

  /* No overflow on body */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* Cards tighter on mobile */
  .card {
    padding: 12px 13px !important;
  }

  /* Clock smaller on mobile */
  #clock {
    font-size: 2rem !important;
  }

  /* Dash cards 2-col */
  .dashboard-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .dash-card {
    padding: 10px 11px !important;
  }

  .dash-card strong {
    font-size: 0.96rem !important;
  }

  /* Summary cards 2-col */
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .summary-card {
    padding: 10px 12px !important;
  }

  .summary-card strong {
    font-size: 1.06rem !important;
  }

  /* Feature panel tighter */
  .feature-panel {
    padding: 9px 10px !important;
  }
}
