:root {
  color-scheme: dark;
  --bg-0: #05080d;
  --bg-1: #0b1118;
  --bg-2: #0e1720;
  --panel: #111d28;
  --panel-alt: #0f1821;
  --line: #203345;
  --line-strong: #2a4359;
  --text: #e7f1fd;
  --muted: #9ab0c8;
  --brand: #76ba43;
  --brand-2: #5fa832;
  --danger: #e25f73;
  --danger-line: #7a3240;
  --ok: #9ce68b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", "Trebuchet MS", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 0% -5%, #143126 0%, transparent 45%),
    radial-gradient(900px 500px at 100% 0%, #132536 0%, transparent 52%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-2) 100%);
}

.shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px 16px 20px;
}

.card {
  background: linear-gradient(180deg, rgba(17, 29, 40, 0.96) 0%, rgba(14, 25, 35, 0.96) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  min-height: calc(100vh - 36px);
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: clamp(1.25rem, 1rem + 1.2vw, 1.8rem);
}

h2 {
  font-size: clamp(1.1rem, 0.95rem + 0.9vw, 1.45rem);
}

h3 {
  font-size: 1rem;
  font-weight: 700;
}

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

.tabs {
  margin: 14px 0 12px;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(7, 12, 18, 0.5);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px;
}

label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(118, 186, 67, 0.18);
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--brand);
  box-shadow: none;
  transform: translateY(1px);
}

input[readonly] {
  background: #0b141d;
  color: #b7cbe0;
  border-style: dashed;
}

textarea {
  resize: vertical;
}

button {
  border-radius: 10px;
  border: 1px solid #5ea933;
  background: linear-gradient(180deg, #7fd153 0%, #65b93c 100%);
  color: #071b0d;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 100ms ease, filter 100ms ease, box-shadow 120ms ease;
  box-shadow: 0 8px 20px rgba(118, 186, 67, 0.2);
}

button:hover {
  filter: brightness(1.05);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  border-color: #3b546c;
  background: linear-gradient(180deg, #1a2a39 0%, #142130 100%);
  color: #d7e8f7;
  box-shadow: none;
}

button.danger {
  border-color: var(--danger-line);
  background: linear-gradient(180deg, #2c1820 0%, #221118 100%);
  color: #ffb8c2;
  box-shadow: none;
}

button.tab {
  margin: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  padding: 8px 14px;
}

button.tab.active {
  border-color: rgba(118, 186, 67, 0.5);
  background: linear-gradient(180deg, rgba(118, 186, 67, 0.25) 0%, rgba(118, 186, 67, 0.12) 100%);
  color: #d9f2c9;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar input {
  flex: 1;
}

#scope-switch-wrap {
  margin: 2px 0 10px;
}

#scope-switch-wrap label {
  margin: 0;
  min-width: 110px;
}

#scope-switch-select {
  min-width: 280px;
  max-width: 560px;
}

.projects-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.project-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0e1720;
  padding: 10px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.project-cover {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: #1a2632;
  border: 1px solid var(--line);
}

.project-title {
  font-weight: 700;
  margin-bottom: 3px;
}

.project-meta {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.chip {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  margin-right: 6px;
  font-size: 0.76rem;
}

.chip.ok {
  color: var(--ok);
  border-color: #3a7f2a;
}

.chip.warn {
  color: #f1dc8d;
  border-color: #7f6d2a;
}

.chip.off {
  color: #ff9aa8;
  border-color: #6e3540;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.item-actions button {
  margin: 0;
  padding: 8px 10px;
  font-size: 0.83rem;
}

.create-form {
  display: grid;
  gap: 6px;
  max-width: 980px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-company-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.admin-infra-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0d1620;
  padding: 10px;
  margin-top: 10px;
}

.admin-infra-details {
  margin: 8px 0 0;
  white-space: pre-wrap;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #d1e2f5;
  background: #0a1219;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  min-height: 120px;
}

.admin-company-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #0d1620;
}

#admin-user-form {
  margin-top: 10px;
  max-width: none;
}

.admin-user-edit-grid {
  display: grid;
  grid-template-columns: 90px minmax(180px, 1fr);
  gap: 6px 10px;
  align-items: center;
}

.admin-user-edit-grid label {
  margin: 0;
}

#admin-users-pagination-wrap {
  justify-content: flex-start;
  gap: 12px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 14, 0.78);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  width: min(760px, 96vw);
  max-height: 88vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #0f1a24 0%, #0c151f 100%);
  padding: 14px;
  box-shadow: var(--shadow);
}

.admin-company-meta {
  margin-top: 8px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-password-tools {
  align-items: stretch;
}

.admin-password-tools input {
  flex: 1;
  min-width: 220px;
}

.password-strength {
  display: grid;
  gap: 6px;
  margin-top: 2px;
  margin-bottom: 4px;
}

.password-strength-bar {
  height: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, #3a1f25 0%, #3a1f25 0%, #1a2734 0%);
}

.hours-planner {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f1821;
  padding: 12px;
}

.hours-planner .row {
  align-items: flex-start;
}

.hours-planner-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.hours-day-row {
  display: grid;
  grid-template-columns: 120px 90px 1fr 1fr 120px 1fr 1fr;
  align-items: center;
  gap: 8px;
}

.hours-day-name {
  font-weight: 700;
  color: #d8e8f6;
}

.hours-inline {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

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

.small {
  font-size: 0.82rem;
}

.error,
.success {
  min-height: 19px;
  margin-top: 8px;
  font-size: 0.9rem;
}

.error {
  color: #ff9cad;
}

.success {
  color: var(--ok);
}

.deploy-logs {
  margin: 8px 0 12px;
  max-height: 260px;
  overflow: auto;
  background: #0a1219;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  color: #d3e3f5;
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: pre-wrap;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 15px 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .shell {
    margin: 0;
    padding: 10px 10px 14px;
  }

  .card {
    padding: 16px;
    border-radius: 12px;
    min-height: calc(100vh - 24px);
  }

  .project-item {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .project-cover {
    width: 56px;
    height: 56px;
  }

  .item-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    margin-top: 8px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .row {
    flex-wrap: wrap;
  }

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

  .admin-password-tools {
    flex-direction: column;
  }

  .hours-day-row {
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px;
  }

  .hours-day-name {
    grid-column: 1 / -1;
  }
}
