@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;500;600;700;800&family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0A1220;
  --bg-alt: #0D1729;
  --bg-elevated: #101B2E;
  --bg-card: #131F35;
  --text: #EDF1F7;
  --text-muted: #93A3BA;
  --text-dim: #5C6E88;
  --blue: #3D82E0;
  --blue-deep: #0B53AA;
  --orange: #FD7133;
  --orange-dim: rgba(253,113,51,0.14);
  --border: #1E2C42;
  --border-soft: #172236;
  --card-light-bg: #F5F6F8;
  --shadow: 0 30px 70px -30px rgba(0,0,0,0.6);
  --focus: #FD7133;
  --green: #2FBF71;
  --red: #E15252;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F6F7FA;
    --bg-alt: #EFF1F5;
    --bg-elevated: #FFFFFF;
    --bg-card: #FFFFFF;
    --text: #0A1220;
    --text-muted: #4B5A70;
    --text-dim: #7C8AA0;
    --blue: #0B53AA;
    --blue-deep: #0B53AA;
    --orange: #D85416;
    --orange-dim: rgba(216,84,22,0.10);
    --border: #E1E5EC;
    --border-soft: #EAEDF2;
    --shadow: 0 30px 70px -35px rgba(10,18,32,0.18);
  }
}
:root[data-theme="light"] {
  --bg: #F6F7FA; --bg-alt: #EFF1F5; --bg-elevated: #FFFFFF; --bg-card: #FFFFFF;
  --text: #0A1220; --text-muted: #4B5A70; --text-dim: #7C8AA0;
  --blue: #0B53AA; --blue-deep: #0B53AA; --orange: #D85416; --orange-dim: rgba(216,84,22,0.10);
  --border: #E1E5EC; --border-soft: #EAEDF2; --shadow: 0 30px 70px -35px rgba(10,18,32,0.18);
}
:root[data-theme="dark"] {
  --bg: #0A1220; --bg-alt: #0D1729; --bg-elevated: #101B2E; --bg-card: #131F35;
  --text: #EDF1F7; --text-muted: #93A3BA; --text-dim: #5C6E88;
  --blue: #3D82E0; --blue-deep: #0B53AA; --orange: #FD7133; --orange-dim: rgba(253,113,51,0.14);
  --border: #1E2C42; --border-soft: #172236; --shadow: 0 30px 70px -30px rgba(0,0,0,0.6);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', ui-sans-serif, system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: 'Unbounded', ui-sans-serif, system-ui, sans-serif; letter-spacing: -0.01em; margin: 0; }
a { color: inherit; }
p { color: var(--text-muted); margin: 0; }
img, svg { max-width: 100%; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-brand .mark-chip {
  width: 40px; height: 40px; border-radius: 10px; background: var(--card-light-bg);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
}
.login-brand .mark-chip img { width: 28px; height: 28px; object-fit: contain; }
.login-brand .brand-text { display: flex; flex-direction: column; gap: 2px; }
.login-brand .wordmark { font-family: 'Unbounded', sans-serif; font-size: 14px; font-weight: 700; letter-spacing: 0.02em; }
.login-brand .tag { font-size: 11px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; letter-spacing: 0.06em; text-transform: uppercase; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  color: var(--text);
}
.field input:focus { border-color: var(--orange); }
.field input:disabled, .field select:disabled, .field textarea:disabled { opacity: 0.6; cursor: not-allowed; }

.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 42px; }
.password-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  background: none; border: none; padding: 6px; cursor: pointer;
  color: var(--text-dim); display: flex; align-items: center; justify-content: center;
}
.password-toggle:hover { color: var(--text-muted); }
.password-toggle svg { width: 18px; height: 18px; }
.password-toggle .eye-off-icon { display: none; }
.password-toggle.showing .eye-icon { display: none; }
.password-toggle.showing .eye-off-icon { display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer;
  border: none; padding: 12px 18px; transition: opacity .15s ease, transform .1s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: #10131c; width: 100%; }
.btn-primary:hover { opacity: 0.92; }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }
.btn-danger-ghost { background: transparent; color: var(--red); border: 1px solid var(--border); }

.login-error {
  background: rgba(225,82,82,0.1); border: 1px solid rgba(225,82,82,0.35); color: #F3A0A0;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 16px; display: none;
}
.login-error.visible { display: block; }
.login-note { margin-top: 20px; font-size: 12.5px; color: var(--text-dim); text-align: center; }

.login-success {
  background: rgba(47,191,113,0.1); border: 1px solid rgba(47,191,113,0.35); color: #7FD9A6;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 16px; display: none;
}
.login-success.visible { display: block; }
.login-links { text-align: center; margin-top: 14px; }
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text-dim); font-size: 12.5px; text-decoration: underline;
}
.link-btn:hover { color: var(--text-muted); }
.forgot-copy { margin-bottom: 16px; font-size: 13.5px; color: var(--text-muted); }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }

/* ---------- Sidebar ---------- */
/* Fixed (not sticky) so it always stays pinned to the viewport, regardless of
   how tall the page content gets or how the window is resized -- it can never
   scroll away or end up behind the main content. .app-main is offset with a
   matching margin-left so it never renders underneath it. */
.sidebar {
  width: 216px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg-alt); border-right: 1px solid var(--border-soft);
  padding: 20px 14px; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto;
  z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 24px; }
.sidebar-brand .mark-chip {
  width: 30px; height: 30px; border-radius: 8px; background: var(--card-light-bg);
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.sidebar-brand .mark-chip img { width: 20px; height: 20px; object-fit: contain; }
.sidebar-brand .wordmark {
  display: flex; flex-direction: column; gap: 2px;
  font-family: 'Unbounded', sans-serif; font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; line-height: 1.3;
}
.sidebar-brand .wordmark .tag {
  font-size: 10px; font-weight: 500; color: var(--text-dim); font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sidebar-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-muted); font-size: 13.5px; font-weight: 600; text-decoration: none;
}
.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--bg-card); color: var(--text); }
.sidebar-link.active { background: var(--orange-dim); color: var(--orange); }
.sidebar-footer {
  border-top: 1px solid var(--border-soft); padding-top: 14px; margin-top: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.sidebar-user {
  font-size: 12px; color: var(--text-muted); padding: 0 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-footer .btn { width: 100%; }

.app-main { min-width: 0; display: flex; flex-direction: column; margin-left: 216px; min-height: 100vh; }

.board-header { padding: 20px 24px 4px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.board-header h1 { font-size: 20px; }
.board-header p { font-size: 13px; margin-top: 4px; }

.board {
  flex: 1;
  display: flex;
  gap: 16px;
  padding: 16px 24px 28px;
  overflow-x: auto;
  align-items: flex-start;
}
.column {
  background: var(--bg-alt);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  min-width: 260px;
  max-width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 150px);
}
.column-head {
  padding: 14px 14px 10px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-soft);
}
.column-title { font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-family: 'JetBrains Mono', monospace; }
.column-count {
  font-size: 11.5px; color: var(--text-dim); background: var(--bg-card);
  border-radius: 999px; padding: 2px 8px; font-family: 'JetBrains Mono', monospace;
}
.column-cards { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; }
.column.drag-over { border-color: var(--orange); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 13px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card:active { cursor: grabbing; }
.card.dragging { opacity: 0.4; }
.card-name { font-weight: 700; font-size: 14px; }
.card-company { font-size: 12.5px; color: var(--text-muted); }
.card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.card-budget { font-size: 11px; color: var(--orange); font-family: 'JetBrains Mono', monospace; }
.card-date { font-size: 10.5px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }
.card-owner {
  display: flex; align-items: center; gap: 5px; margin-top: 2px;
  font-size: 10.5px; color: var(--text-dim);
}
.card-owner svg { width: 11px; height: 11px; flex-shrink: 0; }
.card.card-locked { opacity: 0.72; cursor: default; }

.empty-col { padding: 18px 8px; text-align: center; font-size: 12px; color: var(--text-dim); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,10,20,0.6);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-overlay.visible { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto;
  padding: 26px 26px 22px; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { font-size: 17px; }
.modal-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 20px; line-height: 1; padding: 4px; }
.modal-close:hover { color: var(--text); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field textarea { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; resize: vertical; min-height: 70px; }
.field select { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }
.modal-danger-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; }

.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px; font-size: 13.5px; box-shadow: var(--shadow);
  display: none; z-index: 60;
}
.toast.visible { display: block; }
.toast.error { border-color: rgba(225,82,82,0.4); color: #F3A0A0; }

.loading-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 13px; font-family: 'JetBrains Mono', monospace;
}


/* ---------- Mobile polish ---------- */
@media (max-width: 720px) {
  .sidebar {
    width: 100%; height: auto; position: relative; top: auto; left: auto; overflow-y: visible;
    flex-direction: row; align-items: center; padding: 10px 14px; gap: 14px; z-index: auto;
  }
  .app-main { margin-left: 0; }
  .sidebar-brand { padding: 0; }
  .sidebar-brand .wordmark { display: none; }
  .sidebar-nav { flex-direction: row; flex: 1; gap: 2px; }
  .sidebar-link span { display: none; }
  .sidebar-link { padding: 9px; }
  .sidebar-footer {
    border-top: none; margin-top: 0; padding-top: 0; flex-direction: row; align-items: center; gap: 10px;
  }
  .sidebar-user { display: none; }
  .sidebar-footer .btn { width: auto; }
}

@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
  .board-header { padding: 16px 16px 4px; }
  .board { padding: 12px 16px 22px; }
  .modal { padding: 22px 18px 18px; }
}


/* ---------- Team ---------- */
.team-wrap { padding: 4px 24px 28px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 14px; }
.team-table { width: 100%; border-collapse: collapse; background: var(--bg-alt); min-width: 520px; }
.team-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-dim); font-family: 'JetBrains Mono', monospace; padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft); white-space: nowrap;
}
.team-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; vertical-align: middle; }
.team-table tr:last-child td { border-bottom: none; }
.role-badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 999px; }
.role-badge.role-admin { background: var(--orange-dim); color: var(--orange); }
.role-badge.role-member { background: rgba(61,130,224,0.14); color: var(--blue); }
.team-denied { padding: 40px 24px; color: var(--text-dim); font-size: 13.5px; }
.team-note { margin-top: 16px; font-size: 12.5px; color: var(--text-dim); max-width: 60ch; }

@media (max-width: 520px) {
  .team-wrap { padding: 4px 16px 22px; }
}
