:root {
  --blue: #1d4ed8;
  --blue-dark: #173b94;
  --purple: #7c3aed;
  --ink: #172033;
  --muted: #6b7280;
  --line: #d9e2f2;
  --soft: #f5f8ff;
  --white: #ffffff;
  --danger: #b42318;
  --success: #0f766e;
  --shadow: 0 18px 50px rgba(29, 78, 216, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(135deg, #f7fbff 0%, #ffffff 44%, #f3efff 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(16px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--purple));
}

.main-nav { display: flex; align-items: center; gap: 8px; }

.main-nav a,
.nav-toggle,
.button,
.status-check {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  color: var(--ink);
}

.main-nav a.icon-button {
  justify-content: center;
  padding: 0;
}

.main-nav a.active,
.main-nav a:hover {
  color: #fff;
  background: var(--blue);
}

.logout-link { background: #edf2ff; }
.nav-toggle { display: none; padding: 0 14px; background: #edf2ff; color: var(--blue-dark); }

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 42px;
}

.app-footer {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.6rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 8px 0 0; }

.page-title,
.hero-dashboard {
  margin-bottom: 24px;
}

.page-title-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-title p,
.hero-dashboard p,
.muted,
.tiny { color: var(--muted); }

.tiny { font-size: 0.88rem; }

.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 430px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.single-column {
  display: grid;
  gap: 22px;
}

.form-card,
.list-panel,
.stats-grid article {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-card,
.list-panel {
  padding: 22px;
}

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

.form-card.narrow { max-width: 560px; }

label {
  display: grid;
  gap: 7px;
  color: #27344c;
  font-weight: 700;
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-label {
  color: #27344c;
  font-weight: 700;
}

input,
select,
.editor {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c9d5e8;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus,
.editor:focus {
  outline: 3px solid rgba(124, 58, 237, 0.16);
  border-color: var(--purple);
}

.editor { min-height: 130px; }

.editor-toolbar {
  display: flex;
  gap: 6px;
}

.editor-toolbar button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--blue-dark);
  font-weight: 800;
}

.button,
.status-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  white-space: nowrap;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.icon-actions {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.status-badge {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 40px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--blue-dark);
}

.button.primary { background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; }
.button.ghost { background: #eef4ff; color: var(--blue-dark); }
.button.danger { background: #fff1f0; color: var(--danger); }

.alert {
  margin-bottom: 18px;
  padding: 13px 16px;
  border-radius: 8px;
  font-weight: 700;
}

.alert.success { color: var(--success); background: #ecfdf5; border: 1px solid #a7f3d0; }
.alert.error { color: var(--danger); background: #fff1f0; border: 1px solid #fecaca; }

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

.stats-grid article {
  padding: 22px;
  display: grid;
  gap: 4px;
}

.stats-grid strong {
  font-size: 2.1rem;
  color: var(--blue);
}

.stats-grid span,
.row-item span,
.task-top span,
.maintenance-item span { color: var(--muted); }

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

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

.list-panel.full { margin-top: 22px; }

.row-item,
.task-item,
.maintenance-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.row-item > div,
.task-top > div,
.maintenance-item > div {
  display: grid;
  gap: 4px;
}

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

.actions form { display: inline-flex; }

.task-item {
  display: grid;
  align-items: stretch;
}

.task-card-main {
  display: flex;
  width: 100%;
  gap: 18px;
  align-items: start;
  justify-content: space-between;
}

.task-content {
  display: grid;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.task-item.completed {
  background: #293143;
  color: #dbe5ff;
}

.task-item.completed span { color: #a9b7d6; }
.task-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status-check { background: #edf2ff; color: var(--blue-dark); }
.task-actions {
  flex: 0 0 auto;
  margin-left: auto;
  align-self: start;
}

.task-timeline {
  position: relative;
  display: grid;
  gap: 10px;
  padding-left: 20px;
}

.task-timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: #d7e2f7;
}

.timeline-entry {
  position: relative;
  display: grid;
  gap: 5px;
}

.timeline-entry::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 0 4px #f3efff;
}

.timeline-entry time {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.timeline-entry div {
  color: #27344c;
}

.timeline-entry p {
  margin: 0 0 6px;
}

.task-item.completed .task-timeline::before { background: #56647f; }
.task-item.completed .timeline-entry::before { box-shadow: 0 0 0 4px #293143; }
.task-item.completed .timeline-entry time { color: #a9b7d6; }
.task-item.completed .timeline-entry div { color: #dbe5ff; }

.maintenance-item p { margin: 0; color: #41516d; }

.maintenance-meta,
.tag-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-pill,
.feature-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
}

.meta-pill {
  padding: 6px 10px;
  background: #f4f7ff;
  color: #42526d;
  border: 1px solid #dce6f8;
}

.feature-tag {
  padding: 5px 10px;
  background: #eef4ff;
  color: var(--blue-dark);
}

.domain-expiration {
  color: var(--blue-dark);
}

.domain-expiration.urgent {
  background: #fff1f0;
  border-color: #fecaca;
  color: var(--danger);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input { width: 18px; min-height: 18px; }

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

.notes-history {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.notes-history article {
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
}

.notes-history time {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

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

.pagination a {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--blue-dark);
  font-weight: 800;
}

.pagination a.active { background: var(--blue); color: #fff; }

.hidden { display: none; }

.auth-panel {
  min-height: calc(100vh - 190px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 28px;
  align-items: center;
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; align-items: center; }
  .main-nav {
    position: absolute;
    top: 69px;
    left: 16px;
    right: 16px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }
  .main-nav.open { display: flex; }
  .main-nav a { justify-content: center; }
  .grid.two,
  .auth-panel,
  .stats-grid { grid-template-columns: 1fr; }
  .page-title-actions { align-items: stretch; flex-direction: column; }
}

@media (max-width: 560px) {
  .page-shell { width: min(100% - 22px, 1180px); margin-top: 18px; }
  .app-header { padding: 12px; }
  .form-card,
  .list-panel { padding: 16px; }
  .row-item,
  .maintenance-item,
  .task-top,
  .task-card-main {
    align-items: stretch;
    flex-direction: column;
  }
  .task-card-main { width: 100%; }
  .actions,
  .actions form,
  .button:not(.icon-button) { width: 100%; }
  .icon-actions { justify-content: flex-start; }
  .task-actions { margin-left: 0; }
  .panel-heading { align-items: stretch; flex-direction: column; }
  .check-grid { grid-template-columns: 1fr; }
}
