:root {
  --bg: #030507;
  --bg-2: #060a0f;
  --panel: #080f17;
  --panel-2: #0b1420;
  --panel-3: #101b2a;
  --line: #1b2a3a;
  --line-2: #26384f;
  --text: #f7f9ff;
  --muted: #9aa7b6;
  --muted-2: #657487;
  --blue: #075cff;
  --blue-2: #0b7cff;
  --green: #22c55e;
  --red: #ff3b30;
  --amber: #facc15;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 75% -10%, rgba(7, 92, 255, 0.18), transparent 34%),
    linear-gradient(135deg, #010203 0%, #04070c 45%, #07101a 100%);
  color: var(--text);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

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

button {
  cursor: pointer;
}

.sidebar {
  min-height: 100vh;
  background: rgba(0, 0, 0, 0.78);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px 18px;
  position: sticky;
  top: 0;
}

.brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 10px 0 24px;
}

.brand-logo {
  width: min(200px, 90%);
  max-height: 170px;
  object-fit: contain;
  display: block;
}

.brand span {
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.34em;
}

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

.nav button {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  padding: 13px 15px;
  text-align: left;
  font-weight: 800;
}

.nav button.active,
.nav button:hover {
  background: linear-gradient(135deg, var(--blue), #0041c9);
  color: white;
}

.sidebar-footer {
  position: absolute;
  left: 24px;
  bottom: 22px;
  display: grid;
  gap: 4px;
  color: var(--muted-2);
  font-size: 0.78rem;
}

.sidebar-footer strong {
  color: var(--text);
}

.app {
  min-width: 0;
  padding: 26px 30px 34px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue-2);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

#screenSubtitle {
  margin-bottom: 0;
  color: var(--muted);
}

.top-actions,
.actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

button.primary,
button.ghost,
button.danger,
button.success,
.chip {
  min-height: 42px;
  border: 0;
  border-radius: 13px;
  padding: 0 16px;
  color: white;
  font-weight: 900;
}

button.primary {
  background: linear-gradient(135deg, var(--blue), #0046db);
}

button.ghost {
  background: var(--panel-3);
  color: var(--text);
  border: 1px solid var(--line);
}

button.danger {
  background: rgba(255, 59, 48, 0.14);
  color: #ff746d;
}

button.success {
  background: rgba(34, 197, 94, 0.18);
  color: #5ee58b;
}

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

.privacy-strip {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(15, 26, 39, 0.92), rgba(7, 13, 20, 0.92));
  padding: 14px 16px;
}

.privacy-strip strong,
.privacy-strip span {
  display: block;
}

.privacy-strip span {
  margin-top: 4px;
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.card,
.metric,
.list-card {
  background: linear-gradient(180deg, rgba(15, 26, 39, 0.95), rgba(7, 13, 20, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 132px;
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin: 12px 0 7px;
  font-size: 1.85rem;
}

.metric small {
  color: var(--muted-2);
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 16px;
}

.card {
  padding: 18px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.card-header h2,
.card-header h3 {
  margin: 0;
}

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

.list {
  display: grid;
  gap: 12px;
}

.list-card {
  padding: 16px;
}

.list-card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.date-box {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  align-content: center;
  flex: 0 0 auto;
  border-radius: 16px;
  background: var(--panel-3);
  border: 1px solid var(--line);
}

.date-box strong {
  font-size: 1.65rem;
  line-height: 1;
}

.date-box span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.item-main {
  display: flex;
  gap: 14px;
  min-width: 0;
}

.item-main h3 {
  margin: 0 0 6px;
  font-size: 1.12rem;
}

.item-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.item-main .event-note {
  margin-top: 7px;
  color: var(--text);
  background: rgba(7, 92, 255, 0.1);
  border: 1px solid rgba(11, 124, 255, 0.24);
  border-radius: 10px;
  padding: 8px 10px;
}

.badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.badge.green {
  background: rgba(34, 197, 94, 0.15);
  color: #6ee996;
}

.badge.red {
  background: rgba(255, 59, 48, 0.15);
  color: #ff7c75;
}

.badge.amber {
  background: rgba(250, 204, 21, 0.15);
  color: #ffe06a;
}

.badge.blue {
  background: rgba(7, 92, 255, 0.22);
  color: #79aaff;
}

.progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-3);
  margin-top: 10px;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue-2));
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.chip {
  background: var(--panel-3);
  color: var(--muted);
  border: 1px solid var(--line);
}

.chip.active {
  background: var(--blue);
  color: white;
}

.toolbar {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.search {
  min-width: 280px;
  background: var(--panel-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  outline: none;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-3);
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

input[type="file"] {
  padding: 10px;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue-2);
  box-shadow: 0 0 0 3px rgba(11, 124, 255, 0.14);
}

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

.duration-preview,
.contract-box {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(16, 27, 42, 0.72);
  padding: 12px 13px;
}

.duration-preview {
  display: grid;
  align-content: center;
  gap: 5px;
}

.duration-preview span,
.contract-box span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.duration-preview strong,
.contract-box strong {
  color: var(--text);
  font-size: 1rem;
}

.contract-box p {
  margin: 6px 0 0;
  color: var(--muted);
}

.button-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border-radius: 13px;
  padding: 0 16px;
  background: var(--panel-3);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
}

.summary-view {
  display: grid;
  gap: 14px;
}

.detail-section {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16, 27, 42, 0.42);
  padding: 14px;
}

.detail-section h3 {
  margin-bottom: 12px;
}

.detail-section p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.detail-section ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

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

.detail-item,
.detail-table div {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 15, 23, 0.72);
  padding: 10px 12px;
}

.detail-item span,
.detail-table span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.detail-item strong,
.detail-table strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.detail-table {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.detail-table div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.modal-root,
.login-root {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-root[hidden],
.login-root[hidden],
.toast[hidden] {
  display: none !important;
}

.login-root {
  z-index: 30;
  background:
    radial-gradient(circle at 50% 0%, rgba(7, 92, 255, 0.22), transparent 36%),
    rgba(0, 0, 0, 0.88);
}

.login-card {
  width: min(430px, 100%);
  background: linear-gradient(180deg, rgba(15, 26, 39, 0.98), rgba(5, 9, 14, 0.98));
  border: 1px solid var(--line-2);
  border-radius: 26px;
  box-shadow: 0 34px 120px rgba(0, 0, 0, 0.72);
  padding: 28px;
}

.login-card img {
  display: block;
  width: 180px;
  max-width: 80%;
  margin: 0 auto 18px;
}

.login-card h2 {
  margin-bottom: 6px;
  text-align: center;
}

.login-card p {
  text-align: center;
  color: var(--muted);
  margin-bottom: 20px;
}

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

.login-card button {
  margin-top: 6px;
}

.modal {
  width: min(940px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 24px;
  box-shadow: 0 32px 120px rgba(0, 0, 0, 0.72);
}

.modal-header,
.modal-footer {
  position: sticky;
  background: rgba(6, 10, 15, 0.96);
  z-index: 2;
  padding: 18px 20px;
}

.modal-header {
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.close {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 0;
  background: var(--panel-3);
  color: var(--text);
  font-weight: 900;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 14px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.client-inline {
  display: none;
  grid-column: 1 / -1;
}

.client-inline.visible {
  display: grid;
}

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

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
}

.check-row input {
  width: auto;
}

.money {
  color: var(--green);
  font-weight: 900;
}

.negative {
  color: var(--red);
}

@media (max-width: 1050px) {
  body {
    grid-template-columns: 1fr;
  }

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

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

  .sidebar-footer {
    position: static;
    margin-top: 18px;
  }

  .metrics,
  .grid-2,
  .form-grid,
  .detail-grid,
  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app {
    padding: 18px 14px 22px;
  }

  .topbar,
  .toolbar,
  .list-card-top {
    display: grid;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions button,
  .row-actions button,
  .actions button {
    flex: 1;
  }

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