/* ════════════════════════════════════════
   BASE — Reset, global defaults, shared UI
   Typography tokens → css/typography.css
   Theme colour tokens → css/themes.css
   ════════════════════════════════════════ */

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

/* ── Body ── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-body);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

/* Scanlines — Cyber night mode only */
body[data-theme="cyber"][data-mode="night"]::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg,
      transparent 0px,
      transparent 2px,
      rgba(0, 0, 0, .045) 2px,
      rgba(0, 0, 0, .045) 3px);
  pointer-events: none;
  z-index: 9999;
}

/* ════════════════════════════════════════
   PANELS
   ════════════════════════════════════════ */

.panel {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 4px;
  position: relative;
  box-shadow: 0 4px 6px var(--shadow);
}

/* Panel header strip */
.ph {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surf2);
  border-bottom: 1px solid var(--border);
}

.ph-title {
  font-size: var(--text-d-md);
  letter-spacing: var(--ls-normal);
}

/* ════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════ */

.btn {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  font-family: var(--font-mono);
  font-size: var(--text-md);
  padding: 4px 10px;
  border-radius: 3px;
  letter-spacing: var(--ls-tight);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  background: rgba(128, 128, 128, .1);
}

/* Ghost: icon-only or nav arrow buttons */
.btn-ghost {
  border: none;
  opacity: .75;
  font-size: var(--text-cat);
  padding: 4px 4px;
  min-width: 16px;
}

.btn-ghost:hover {
  opacity: 1;
  background: transparent;
}

/* Icon button: square icon-only action */
.icon-btn {
  background: transparent;
  border: none;
  opacity: .8;
  font-size: 16px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
}

.icon-btn:hover {
  opacity: 1;
  background: rgba(128, 128, 128, .12);
}

/* Filled primary action (confirm / create) */
.btn-primary {
  background: var(--c1);
  border-color: var(--c1);
  color: var(--bg);
  /* dark bg for contrast on teal/etc. */
}

.btn-primary:hover {
  background: transparent;
  color: var(--c1);
  border-color: var(--c1);
}

/* Filled destructive action (delete) */
.btn-danger {
  background: var(--c2);
  border-color: var(--c2);
  color: #fff;
}

.btn-danger:hover {
  background: transparent;
  color: var(--c2);
  border-color: var(--c2);
}

/* Soft warning action (low-stakes delete — task, event, milestone) */
.btn-warn {
  background: var(--c3);
  border-color: var(--c3);
  color: var(--bg);
}

.btn-warn:hover {
  background: transparent;
  color: var(--c3);
  border-color: var(--c3);
}

/* ════════════════════════════════════════
   INPUTS & FORM CONTROLS
   ════════════════════════════════════════ */

.inp {
  background: var(--surf2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-ui);
  padding: 8px 12px;
  border-radius: 3px;
  outline: none;
  width: 100%;
}

.inp:focus {
  border-color: var(--c1);
}

.priority-select {
  background: var(--surf2);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: var(--text-md);
  border-radius: 4px;
  padding: 4px 8px;
  min-width: 100px;
}

/* ════════════════════════════════════════
   MODAL
   ════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background: var(--surf);
  border: 1px solid var(--c1);
  border-radius: 6px;
  padding: 24px;
  width: min(100%, 450px);
  max-height: 90vh;
  overflow-y: auto;
}

/* ════════════════════════════════════════
   MOBILE — Overrides for small screens
   ════════════════════════════════════════ */

.mobile-only-btn {
  display: none !important;
}

@media (max-width: 900px) {
  .mobile-only-btn {
    display: inline-flex !important;
  }
}

/* ── Mobile tab bar — schedule / work log switcher ── */
.mobile-tab-bar {
  display: none;
  /* hidden on desktop */
  gap: 0;
  position: sticky;
  top: 60px;
  /* sit below the header */
  z-index: 40;
  background: var(--surf2);
  border-bottom: 1px solid var(--border);
}

.mobile-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: var(--text-md);
  letter-spacing: var(--ls-tight);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.mobile-tab.active {
  color: var(--c1);
  border-color: var(--c1);
}

@media (max-width: 900px) {

  /* Panel hidden on mobile when its tab isn't active */
  .mobile-hidden {
    display: none !important;
  }

  /* Show the tab bar */
  .mobile-tab-bar {
    display: flex;
  }

  /* Header: smaller wordmark, less padding */
  .type-wordmark {
    font-size: var(--text-d-lg) !important;
  }

  /* Progress panel: compact layout, smaller % number */
  .type-big-pct {
    font-size: var(--text-d-lg) !important;
  }

  /* Bigger touch targets for all buttons */
  .btn {
    padding: 8px 14px;
    font-size: var(--text-ui);
    min-height: 44px;
  }

  .btn-ghost {
    min-height: 44px;
    padding: 8px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
  }

  /* Task action buttons always visible on mobile */
  .task-action-btn {
    opacity: .7 !important;
  }

  /* Larger priority dot on mobile */
  .task-row .priority-dot {
    width: 14px !important;
    height: 14px !important;
  }

  /* Task row: bigger, easier to tap */
  .task-row {
    padding: 12px 14px 12px 20px;
    min-height: 52px;
    gap: 12px;
  }

  /* Checkbox: bigger tap target */
  .task-row input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
  }
}