/* ── VARIABLES ─────────────────────────────────────────── */
:root {
  --bg: #0f1117;
  --surface: #161b22;
  --card: #1c2128;
  --border: #30363d;
  --accent: #00d4aa;
  --accent-dim: #004d3d;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #ff4d6d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --hover: rgba(255, 255, 255, .05);
  --sidebar-w: 220px;
  --radius: 10px;
  --radius-sm: 6px;
}

/* ── LIGHT THEME ───────────────────────────────────────── */
[data-theme="light"] {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --card: #eef1f4;
  --border: #d0d7de;
  --accent: #0099a8;
  --accent-dim: #cceef2;
  --green: #1a7f37;
  --yellow: #9a6700;
  --red: #d1242f;
  --text: #1f2328;
  --text-muted: #57606a;
  --hover: rgba(0, 0, 0, .05);
}

[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
  opacity: 0.5;
}

[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator:hover {
  filter: none;
  opacity: 1;
}

/* ── THEME TOGGLE ──────────────────────────────────────── */
.theme-toggle {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color .15s, transform .2s;
}

.theme-toggle:hover {
  color: var(--text);
  transform: rotate(20deg) scale(1.15);
}

.theme-toggle svg {
  display: block;
}

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

html,
body {
  height: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: 14px;
}

textarea {
  resize: vertical;
}

/* ── SIDEBAR ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  color: var(--text);
}

.logo-icon {
  font-size: 22px;
  color: var(--accent);
}

.logo-text strong {
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: background .15s, color .15s;
}

.nav-link:hover {
  background: var(--card);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.back-link {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  padding: 12px 20px;
  transition: color .15s;
}

.back-link:hover {
  color: var(--accent);
}

.sidebar-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.tip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── MAIN ──────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 18px;
  font-weight: 600;
}

/* ── VIEWS ─────────────────────────────────────────────── */
.view {
  display: none;
  padding: 28px;
}

.view.active {
  display: block;
}

/* ── SKELETON LOADING ──────────────────────────────────── */
@keyframes view-fade-in {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-skeleton {
  animation: view-fade-in .22s ease-out forwards;
}

/* ── BUTTON PRESS ANIMATION ────────────────────────────── */
@keyframes btn-press {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(0.93);
  }

  100% {
    transform: scale(1);
  }
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-clear-pill,
.btn-sm,
.board-filter,
.layout-btn,
.skill-filter-btn,
.modal-tab-btn,
.goal-period-tab,
.cal-layout-btn,
.cal-event-filter,
.an-filter-btn,
.ob-arrow-btn,
.back-to-top,
.card-delete-btn,
.card-pin-btn,
.skill-expand-toggle,
.board-select-btn {
  transform-origin: center;
}

.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active,
.btn-clear-pill:active,
.btn-sm:active,
.board-filter:active,
.layout-btn:active,
.skill-filter-btn:active,
.modal-tab-btn:active,
.goal-period-tab:active,
.cal-layout-btn:active,
.cal-event-filter:active,
.an-filter-btn:active,
.ob-arrow-btn:active,
.back-to-top:active,
.card-delete-btn:active,
.card-pin-btn:active,
.skill-expand-toggle:active,
.board-select-btn:active {
  animation: btn-press .18s ease-out forwards;
}

/* ── BUTTONS ───────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: opacity .15s;
}

.btn-primary:hover {
  opacity: .85;
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: border-color .15s;
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-sm {
  padding: 5px 12px !important;
  font-size: 12px !important;
}

.btn-clear-pill {
  background: rgba(220, 80, 80, .07) !important;
  border: 1px solid rgba(220, 80, 80, .2) !important;
  border-radius: 99px !important;
  padding: 3px 10px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: var(--red) !important;
  opacity: 0.75;
  transition: background .15s, border-color .15s, opacity .15s !important;
}

.btn-clear-pill:hover {
  background: rgba(220, 80, 80, .16) !important;
  border-color: rgba(220, 80, 80, .4) !important;
  color: var(--red) !important;
  opacity: 1;
}

.btn-danger {
  background: transparent;
  color: var(--red);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--red);
  transition: background .15s;
}

.btn-danger:hover {
  background: rgba(255, 77, 109, .12);
}

/* ── FORM ELEMENTS ─────────────────────────────────────── */
.text-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  transition: border-color .15s;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.6);
  cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  filter: invert(1) opacity(1);
}

.text-area {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  transition: border-color .15s;
}

.text-area:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}

.select-input {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 32px 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' viewBox='0 0 10 6'%3E%3Cpath stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  transition: border-color .15s, box-shadow .15s;
}

.select-input:hover {
  border-color: var(--text-muted);
}

.select-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}

.form-row {
  display: flex;
  gap: 14px;
}

.form-row.two-col>* {
  flex: 1;
}

.form-row.three-col>* {
  flex: 1;
}

.form-row.four-col>* {
  flex: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  transition: color .15s;
}

/* Label shifts to accent when its field is focused */
.form-group:focus-within .form-label {
  color: var(--accent);
}

.label-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
}

/* ── SCOPE NOTICE ──────────────────────────────────────── */
.scope-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(0, 212, 170, .06);
  border: 1px solid rgba(0, 212, 170, .2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.scope-notice strong {
  color: var(--text);
}

.scope-notice-icon {
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── TOAST ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 999;
  transform: translateY(20px);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast.success {
  border-color: var(--green);
  color: var(--green);
}

.toast.error {
  border-color: var(--red);
  color: var(--red);
}

/* ── BACK TO TOP ─────────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  z-index: 998;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s, border-color .15s, color .15s;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}