/* ==========================================================================
   Project Hub - light theme design system
   ========================================================================== */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-sunken: #fafbfc;
  --surface-hover: #f7f9fc;
  --border: #e4e8ed;
  --border-strong: #d3d9e0;

  --text: #141a24;
  --text-muted: #6b7482;
  --text-faint: #98a1ae;

  --accent: #2f6bed;
  --accent-hover: #1f57cc;
  --accent-soft: #ecf2fe;
  --accent-border: #c5d8fb;
  --accent-ring: rgba(47, 107, 237, 0.16);

  --ok: #0d7a52;
  --ok-bg: #e6f6ef;
  --ok-border: #bfe4d4;

  --warn: #92570a;
  --warn-bg: #fdf3e3;
  --warn-border: #f0dcb6;

  --danger: #b3242f;
  --danger-bg: #fdedee;
  --danger-border: #f5cccf;
  --danger-hover: #97131d;

  --radius-sm: 6px;
  --radius: 9px;
  --radius-lg: 14px;

  --shadow-xs: 0 1px 2px rgba(20, 26, 36, 0.05);
  --shadow-sm: 0 1px 3px rgba(20, 26, 36, 0.08), 0 1px 2px rgba(20, 26, 36, 0.04);
  --shadow-md: 0 10px 24px -12px rgba(20, 26, 36, 0.22);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  font-family: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand__mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(140deg, var(--accent), #6aa1ff);
  box-shadow: 0 2px 6px rgba(47, 107, 237, 0.35);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav__form {
  display: inline-flex;
  margin-left: 6px;
}

.nav__link {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 550;
  transition: background 0.15s, color 0.15s;
}

.nav__link:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav__link.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- page ---------- */

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 20px 70px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head__title {
  font-size: 25px;
  font-weight: 660;
  letter-spacing: -0.02em;
}

.page-head__subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 14px;
}

.page-head__actions {
  display: flex;
  gap: 8px;
}

/* ---------- toolbar ---------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

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

.toolbar__search input[type="search"] {
  width: 260px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.toolbar__search input[type="search"]::placeholder {
  color: var(--text-faint);
}

.chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chips__divider {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding-left: 14px;
  border-left: 1px solid var(--border-strong);
  font-size: 13px;
  font-weight: 570;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 640;
}

/* ---------- table ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
}

.table thead th {
  padding: 11px 18px;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  white-space: nowrap;
}

.table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.table tbody tr:hover {
  background: var(--surface-hover);
}

.cell-title {
  font-weight: 600;
  letter-spacing: -0.005em;
}

.cell-sub {
  margin-top: 3px;
  max-width: 520px;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.table__actions-col {
  text-align: right;
}

.table__actions {
  text-align: right;
  white-space: nowrap;
}

.table__actions form {
  display: inline-block;
  margin-left: 8px;
}

.table__actions .btn {
  vertical-align: middle;
}

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 620;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--active {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

.badge--maintenance {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.badge--bug {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

/* ---------- links ---------- */

.link {
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 570;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.link__arrow {
  margin-left: 3px;
  font-size: 11px;
  opacity: 0.75;
}

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

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn--sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(47, 107, 237, 0.28);
}

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn--ghost:hover {
  background: var(--surface-hover);
  border-color: var(--text-faint);
}

.btn--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn--quiet:hover {
  background: var(--surface-hover);
  color: var(--text);
}

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

.btn--danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.btn:focus-visible,
.chip:focus-visible,
.nav__link:focus-visible,
.link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ---------- empty state ---------- */

.empty {
  padding: 58px 24px;
  text-align: center;
}

.empty__title {
  font-size: 15px;
  font-weight: 620;
}

.empty__text {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ---------- flashes ---------- */

.flash {
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
}

.flash--success {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

.flash--error {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.flash--info {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

/* ---------- forms ---------- */

.form-card {
  max-width: 680px;
  padding: 26px 28px 28px;
}

.form {
  display: block;
}

.field {
  margin-bottom: 18px;
}

.field > label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 620;
}

.field__required {
  color: var(--danger);
}

.hint {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12.5px;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

select {
  height: 40px;
  padding: 0 10px;
  cursor: pointer;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.form__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.form__actions .btn--quiet {
  margin-left: auto;
}

.errors {
  margin: 0 0 20px;
  padding: 13px 16px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13.5px;
}

.errors ul {
  margin: 0;
  padding-left: 18px;
}

.errors li + li {
  margin-top: 3px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* ---------- auth pages ---------- */

.auth-wrap {
  display: grid;
  place-items: center;
  padding: 56px 20px 80px;
}

.auth-card {
  width: 100%;
  max-width: 390px;
  padding: 30px 30px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.auth-card__title {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.auth-card__subtitle {
  margin-top: 5px;
  margin-bottom: 22px;
  color: var(--text-muted);
  font-size: 13.5px;
}

.auth-card .btn--primary {
  width: 100%;
  margin-top: 6px;
}

.auth-card__foot {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
  text-align: center;
}

.auth-card__foot a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 570;
}

.auth-card__foot a:hover {
  text-decoration: underline;
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .topbar__inner {
    height: auto;
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .page {
    padding: 22px 16px 56px;
  }

  .page-head__title {
    font-size: 22px;
  }

  .toolbar__search input[type="search"] {
    width: 100%;
  }

  .toolbar__search {
    width: 100%;
  }

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

  .form-card {
    padding: 20px 18px 22px;
  }
}
