:root {
  color-scheme: light;
  --bg: #f6f4f1;
  --surface: #ffffff;
  --surface-2: #f0ebe5;
  --ink: #211914;
  --muted: #716860;
  --line: #e2d8ce;
  --primary: #c25f14;
  --primary-dark: #9f4b0d;
  --accent: #166d68;
  --danger: #b42318;
  --blue: #2563eb;
  --violet: #7c3aed;
  --sidebar-bg: #c25f14;
  --sidebar-bg-2: #9f4b0d;
  --sidebar-ink: #fff7ed;
  --input-bg: #ffffff;
  --table-head: #f3ede6;
  --panel-soft: #fbf7f2;
  --shadow: rgba(33, 25, 20, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171412;
  --surface: #211d1a;
  --surface-2: #2d2722;
  --ink: #f7efe7;
  --muted: #b9aba0;
  --line: #3b332d;
  --primary: #e97922;
  --primary-dark: #c76017;
  --accent: #44b8ad;
  --danger: #f97066;
  --sidebar-bg: #a84f10;
  --sidebar-bg-2: #6f330b;
  --sidebar-ink: #fff7ed;
  --input-bg: #181512;
  --table-head: #2a241f;
  --panel-soft: #1d1916;
  --shadow: rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(55, 22, 5, 0.54), rgba(15, 12, 10, 0.28), rgba(72, 30, 5, 0.5)),
    url("/assets/login-titan-bitcoin-optimized.jpg") center / cover no-repeat;
}

.login-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.1), transparent 24%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.32));
  pointer-events: none;
}

.login-prefs {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.login-box {
  position: relative;
  z-index: 1;
  width: min(380px, calc(100vw - 32px));
  background: rgba(255, 250, 246, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 14px;
  padding: 34px 32px 28px;
  box-shadow: 0 28px 90px rgba(45, 21, 6, 0.34);
  color: #26313a;
  pointer-events: auto;
}

:root[data-theme="dark"] .login-box {
  background: rgba(31, 25, 21, 0.94);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

.login-logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffb35c, #c25f14);
  color: #ffffff;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 10px 26px rgba(194, 95, 20, 0.32);
  overflow: hidden;
}

.login-logo.titan-logo {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  letter-spacing: 0;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.36), transparent 42%),
    linear-gradient(135deg, #f6b35e 0%, #c25f14 52%, #66300b 100%);
  border: 1px solid rgba(255, 255, 255, 0.42);
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-box h1,
.page-title h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0;
}

.login-box h1 {
  text-align: center;
  font-size: 24px;
  font-weight: 850;
}

.login-box p,
.page-title p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-box > p {
  text-align: center;
  color: #7d8790;
  font-size: 13px;
}

:root[data-theme="dark"] .login-box > p {
  color: var(--muted);
}

.login-fields {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.login-field label {
  color: #52606d;
  font-size: 12px;
}

:root[data-theme="dark"] .login-field label {
  color: var(--muted);
}

.login-field input {
  min-height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

:root[data-theme="dark"] .login-field input {
  background: rgba(24, 21, 18, 0.9);
}

.password-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.password-wrap input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.password-toggle {
  flex: 0 0 42px;
  width: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:root[data-theme="dark"] .password-toggle {
  background: rgba(24, 21, 18, 0.9);
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #8a9299;
}

.forgot-link {
  padding: 0;
  color: var(--primary);
  background: transparent;
  font-weight: 800;
}

.login-submit {
  min-height: 42px;
  border-radius: 9px;
  box-shadow: 0 14px 26px rgba(194, 95, 20, 0.28);
}

.login-access {
  text-align: center;
  font-size: 12px;
  color: #8a9299;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-ink);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 800;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  overflow: hidden;
  font-size: 13px;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: rgba(255, 247, 237, 0.86);
  background: transparent;
  border-radius: 7px;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.user-mini {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.user-mini span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.segmented button {
  min-width: 42px;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.segmented button.active {
  color: #ffffff;
  background: var(--primary);
}

.content {
  width: min(100%, 1800px);
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 18px;
  min-width: 0;
}

.page-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.stat,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}

.panel {
  padding: 18px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
  letter-spacing: 0;
}

.stat {
  padding: 16px;
}

.stat b {
  display: block;
  font-size: 28px;
}

.stat span {
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 7px;
  color: #ffffff;
  background: var(--primary);
  font-weight: 700;
}

.btn:hover {
  background: var(--primary-dark);
}

.btn.secondary {
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.btn.secondary:hover {
  background: var(--table-head);
}

.btn.danger {
  background: var(--danger);
}

.btn.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 13px;
}

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form .full {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--input-bg);
}

.field textarea {
  min-height: 86px;
  resize: vertical;
}

.table-wrap {
  overflow: auto;
}

.table-note {
  margin: 0 0 8px;
  padding: 0 2px;
  font-size: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}

.table-wrap table {
  min-width: 760px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--table-head);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.notice,
.error {
  padding: 10px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
}

.notice {
  background: rgba(22, 109, 104, 0.12);
  color: var(--accent);
}

.error {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.kanban-col {
  min-height: 220px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.kanban-col h3 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 15px;
}

.deal-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.deal-card b {
  line-height: 1.25;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(22, 109, 104, 0.14);
  color: var(--accent);
  font-size: 12px;
}

.checkboxes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.check input {
  width: 16px;
  height: 16px;
}

.brand-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.brand-preview img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
}

.copyright {
  width: min(100%, 1800px);
  margin: auto auto 0;
  padding: 10px 24px 14px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (min-width: 1600px) {
  .layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .content {
    padding: 28px;
  }

  .grid.cols-3 {
    grid-template-columns: repeat(3, minmax(260px, 1fr));
  }
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 236px minmax(0, 1fr);
  }

  .grid.cols-2 {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 18px;
  }
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 14px;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .user-mini {
    width: auto;
  }

  .topbar,
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .grid.cols-2,
  .grid.cols-3,
  .form {
    grid-template-columns: 1fr;
  }

  .checkboxes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .login {
    padding: 80px 14px 24px;
    place-items: start center;
  }

  .login-prefs {
    top: 12px;
    right: 12px;
    left: 12px;
  }

  .login-prefs .segmented {
    width: auto;
    flex: 1;
  }

  .login-box {
    padding: 28px 22px 24px;
  }

  .login-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .content {
    padding: 14px;
  }

  .topbar {
    padding: 12px 14px;
  }

  .nav {
    grid-template-columns: 1fr 1fr;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
  }

  .btn {
    width: 100%;
  }

  .toolbar .btn,
  .top-actions .btn {
    width: auto;
  }

  .user-mini {
    width: 100%;
  }

  .kanban {
    grid-template-columns: 1fr;
  }

  .table-wrap table {
    min-width: 640px;
  }

  .copyright {
    padding-inline: 14px;
  }
}
