:root {
  --orange: #d4521a;
  --orange-soft: #fde6dc;
  --orange-dark: #9e3609;
  --ink: #191b2a;
  --ink-soft: #2b2f47;
  --line: #dde3ec;
  --text: #1f2430;
  --text-soft: #697180;
  --surface: #ffffff;
  --surface-muted: #f6f8fb;
  --green: #238857;
  --amber: #b7791f;
  --red: #c24141;
  --blue: #2563eb;
  --radius: 18px;
  --shadow: 0 18px 44px rgba(22, 28, 45, 0.08);
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(circle at top left, rgba(212, 82, 26, 0.14), transparent 28%),
    linear-gradient(180deg, #eef2f7 0%, #f7f9fc 40%, #eef3f8 100%);
  color: var(--text);
}

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

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
}

.muted {
  color: var(--text-soft);
  font-size: 13px;
}

.button {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.text-button {
  border: 0;
  background: none;
  color: var(--orange-dark);
  cursor: pointer;
  padding: 12px 0;
  font-weight: 700;
  text-decoration: underline;
}

.sidebar-reset {
  color: #fff;
  margin-top: 8px;
  text-align: center;
}

.sync-status {
  min-height: 20px;
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(17, 19, 33, .7);
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-card {
  position: relative;
  width: min(480px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.modal-card h2 { margin: 0 0 10px; }
.modal-card p { line-height: 1.5; }
.modal-close { position: absolute; right: 16px; top: 16px; }
.modal-card .login-form { margin-top: 20px; }

.button-primary {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 12px 24px rgba(212, 82, 26, 0.22);
}

.button-secondary {
  background: var(--ink);
  color: #fff;
}

.button-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.button-danger {
  background: rgba(194, 65, 65, 0.12);
  color: var(--red);
  border: 1px solid rgba(194, 65, 65, 0.2);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.login-hero {
  padding: 72px;
  background:
    radial-gradient(circle at 20% 20%, rgba(242, 115, 66, 0.28), transparent 30%),
    linear-gradient(135deg, #111321 0%, #21263d 54%, #442012 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 8px 14px 8px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 700;
}

.login-badge img {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  border-radius: 50%;
  display: block;
  object-fit: contain;
}

.login-hero h1 {
  margin: 0 0 12px;
  font-size: 53px;
  line-height: 1;
  max-width: 560px;
}

.login-hero p {
  max-width: 540px;
  font-size: 17px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
}

.login-points {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.login-points li {
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  width: fit-content;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-radius: 28px;
  padding: 42px;
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 0;
  font-size: 31px;
}

.login-copy {
  margin: 10px 0 24px;
  color: var(--text-soft);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label,
.textarea-field span {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.login-form input,
.search input,
.toolbar select,
.cpv-form input,
.textarea-field textarea,
#drawer-notes {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--surface);
}

.inline-error {
  font-size: 13px;
  color: var(--red);
  background: rgba(194, 65, 65, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
}

.login-footnote {
  margin-top: 18px;
  color: var(--text-soft);
  font-size: 12px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(17, 19, 33, 0.98), rgba(30, 35, 56, 0.98)),
    var(--ink);
  color: #fff;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.brand-mark img {
  width: 36px;
  height: 36px;
  max-width: 36px;
  max-height: 36px;
  display: block;
  object-fit: contain;
  border-radius: 50%;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  margin-top: 2px;
}

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

.nav-item {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  text-align: left;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.08);
}

.sidebar-box {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 16px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
  margin-top: auto;
}

.sidebar-title {
  margin: 0 0 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.logout-button {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}

.main {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 33px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill,
.status-date {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(221, 227, 236, 0.9);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.stats-grid,
.dashboard-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.dashboard-grid {
  grid-template-columns: 1.35fr 1fr;
}

.cpv-grid {
  grid-template-columns: 0.95fr 1.05fr;
}

.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(221, 227, 236, 0.8);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-header-stack {
  align-items: flex-start;
  flex-direction: column;
}

.panel-header h2 {
  margin: 0;
  font-size: 19px;
}

.table-wrap,
.priority-list,
.timeline,
.chip-list {
  padding: 18px 24px 24px;
}

.toolbar {
  width: 100%;
  display: grid;
  grid-template-columns: 1.5fr 180px 180px 170px;
  gap: 12px;
  align-items: end;
}

.search {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

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

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

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
}

tbody tr:hover {
  background: rgba(246, 248, 251, 0.8);
}

.title-cell strong {
  display: block;
  margin-bottom: 5px;
}

.title-cell span {
  font-size: 12px;
  color: var(--text-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.badge-high {
  background: rgba(212, 82, 26, 0.12);
  color: var(--orange-dark);
}

.badge-medium {
  background: rgba(183, 121, 31, 0.12);
  color: var(--amber);
}

.badge-low {
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue);
}

.badge-new {
  background: rgba(35, 136, 87, 0.1);
  color: var(--green);
}

.badge-follow {
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue);
}

.badge-scheduled {
  background: rgba(183, 121, 31, 0.12);
  color: var(--amber);
}

.badge-discarded {
  background: rgba(194, 65, 65, 0.12);
  color: var(--red);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.table-action-danger {
  color: var(--red);
  border-color: rgba(194, 65, 65, 0.24);
}

.priority-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(180deg, #fff, #fbfcff);
  display: grid;
  gap: 12px;
}

.priority-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.priority-card h3 {
  margin: 0;
  font-size: 18px;
}

.priority-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.priority-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 14px;
  padding: 10px 0;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 6px rgba(212, 82, 26, 0.1);
}

.timeline-item strong {
  display: block;
  margin-bottom: 5px;
}

.timeline-item p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.cpv-form {
  padding: 20px 24px 0;
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange-dark);
  font-size: 13px;
  font-weight: 800;
}

.chip button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 16px;
}

.textarea-field {
  display: grid;
  gap: 8px;
  padding: 20px 24px 16px;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 100%);
  height: 100vh;
  background: rgba(255, 255, 255, 0.98);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 48px rgba(18, 24, 40, 0.16);
  display: grid;
  grid-template-rows: auto 1fr auto;
  z-index: 20;
}

.drawer-header,
.drawer-footer {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-footer {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.drawer-header h2 {
  margin: 0;
  font-size: 23px;
}

.app-footer {
  width: fit-content;
  margin-top: 18px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  box-shadow: none;
}

.app-footer a {
  color: var(--orange);
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--orange-dark);
  text-decoration: underline;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 24px;
}

.drawer-body {
  padding: 18px 22px 28px;
  overflow: auto;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.detail-section {
  margin-bottom: 22px;
}

.detail-section h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.detail-section p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  z-index: 30;
}

.toast {
  background: rgba(25, 27, 42, 0.96);
  color: #fff;
  padding: 14px 16px;
  border-radius: 14px;
  min-width: 260px;
  box-shadow: var(--shadow);
}

.stat-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(221, 227, 236, 0.8);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
  text-align: left;
  cursor: pointer;
}

.stat-card:hover {
  border-color: rgba(212, 82, 26, 0.42);
  transform: translateY(-1px);
}

.stat-card strong {
  display: block;
  font-size: 32px;
  margin-bottom: 6px;
}

.stat-card span {
  color: var(--text-soft);
  font-size: 13px;
}

.resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.resource-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.resource-link:hover {
  color: var(--orange);
  border-color: rgba(212, 82, 26, 0.38);
}

@media (max-width: 1200px) {
  .stats-grid,
  .dashboard-grid,
  .cpv-grid,
  .toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .login-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .main {
    padding: 20px;
  }

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