/* ZCS Projects — Zero Cost Skill design system */
:root {
  --ink: #111814;
  --ink-soft: #1c2420;
  --paper: #f2f0ea;
  --paper-elevated: #faf9f6;
  --mist: #e4e1d8;
  --line: #d0ccc0;
  --muted: #6b726c;
  --copper: #c86b3c;
  --copper-deep: #a3532c;
  --teal: #1a7a6d;
  --success: #2f7d4a;
  --warning: #b7791f;
  --danger: #b42318;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(17, 24, 20, 0.06), 0 8px 24px rgba(17, 24, 20, 0.06);
  --font-display: "Oxanium", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ——— Auth / Login ——— */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--ink);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 10% 20%, rgba(200, 107, 60, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 80%, rgba(26, 122, 109, 0.2), transparent 50%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 18px,
      rgba(255, 255, 255, 0.015) 18px,
      rgba(255, 255, 255, 0.015) 19px
    );
  pointer-events: none;
}

.auth-brand {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem 1.5rem 1.5rem;
  min-height: 28vh;
}

.auth-brand .mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 8vw, 4rem);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0 0 0.75rem;
}

.auth-brand .mark span {
  color: var(--copper);
}

.auth-brand p {
  margin: 0;
  max-width: 28rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1rem;
}

.auth-panel {
  position: relative;
  z-index: 1;
  background: var(--paper-elevated);
  color: var(--ink);
  border-radius: 24px 24px 0 0;
  padding: 2rem 1.5rem 2.5rem;
  flex: 1;
  animation: riseIn 0.6s var(--ease) both;
}

.auth-panel h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.auth-panel .sub {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
}

@media (min-width: 900px) {
  .auth-page {
    grid-template-columns: 1.05fr 0.95fr;
  }

  .auth-brand {
    min-height: 100vh;
    padding: 3.5rem 4rem;
    justify-content: center;
  }

  .auth-brand .mark {
    font-size: 4.5rem;
  }

  .auth-panel {
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 4rem;
    max-width: none;
  }

  .auth-footer {
    position: absolute;
    bottom: 1.25rem;
    left: 0;
    right: 50%;
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ——— Forms ——— */
.field {
  margin-bottom: 1.15rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.field-input {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 0 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field-input:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(200, 107, 60, 0.18);
}

.field-input i {
  color: var(--muted);
  font-size: 1.15rem;
}

.field-input input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0.9rem 0;
  outline: none;
  color: var(--ink);
  min-width: 0;
}

.field-input .toggle-pw {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  padding: 0.35rem;
  display: inline-flex;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
  flex-wrap: wrap;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox input:checked {
  background: var(--ink);
}

.checkbox input:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.link-quiet {
  color: var(--copper-deep);
  font-size: 0.9rem;
  font-weight: 600;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--ink);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: var(--ink-soft);
  box-shadow: var(--shadow);
}

.btn-copper {
  background: var(--copper);
  color: #fff;
}

.btn-copper:hover {
  background: var(--copper-deep);
}

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: #fff;
}

.btn-sm {
  padding: 0.5rem 0.85rem;
  font-size: 0.875rem;
}

.alert {
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: #fef3f2;
  color: var(--danger);
  border: 1px solid #fecdca;
}

.alert-success {
  background: #ecfdf3;
  color: var(--success);
  border: 1px solid #a6f4c5;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn.is-loading .spinner {
  display: inline-block;
}

.btn.is-loading .btn-label {
  opacity: 0.85;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ——— App shell ——— */
.app-shell {
  min-height: 100vh;
  display: flex;
  background:
    radial-gradient(ellipse 50% 30% at 100% 0%, rgba(200, 107, 60, 0.08), transparent 60%),
    var(--paper);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--ink);
  color: #fff;
  z-index: 60;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s var(--ease);
  will-change: transform;
}

.sidebar.is-open {
  transform: translateX(0);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand .logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.sidebar-brand .logo span {
  color: var(--copper);
}

.sidebar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  overflow-y: auto;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 0.25rem;
  transition: background 0.2s, color 0.2s;
  font-weight: 500;
}

.nav-item i {
  font-size: 1.2rem;
  width: 1.25rem;
  text-align: center;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(200, 107, 60, 0.22);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--copper);
}

.sidebar-foot {
  padding: 1rem 1.25rem 1.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 20, 0.55);
  z-index: 55;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s;
}

.sidebar-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
  background: rgba(242, 240, 234, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  color: var(--ink);
  flex-shrink: 0;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.65rem 0.35rem 0.35rem;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  max-width: 180px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-meta {
  min-width: 0;
  display: none;
}

.user-meta strong {
  display: block;
  font-size: 0.8rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta span {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: capitalize;
}

.content {
  padding: 1.25rem 1rem 2.5rem;
  flex: 1;
  animation: fadeUp 0.45s var(--ease) both;
}

@media (min-width: 768px) {
  .topbar {
    padding: 0 1.5rem;
  }

  .content {
    padding: 1.5rem 1.5rem 2.5rem;
  }

  .user-meta {
    display: block;
  }

  .page-title {
    font-size: 1.35rem;
  }
}

@media (min-width: 1024px) {
  .sidebar {
    transform: translateX(0);
  }

  .sidebar-close {
    display: none;
  }

  .menu-toggle {
    display: none;
  }

  .sidebar-backdrop {
    display: none;
  }

  .main-wrap {
    margin-left: var(--sidebar-w);
  }

  .topbar {
    padding: 0 2rem;
  }

  .content {
    padding: 1.75rem 2rem 3rem;
  }
}

/* ——— UI primitives ——— */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 560px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 72px;
  height: 72px;
  background: radial-gradient(circle at top right, rgba(200, 107, 60, 0.16), transparent 70%);
  pointer-events: none;
}

.stat-card .label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.stat-card .value {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.02em;
  word-break: break-word;
}

.stat-card .icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--mist);
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 1.2rem;
}

.panel {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.panel-body {
  padding: 1rem 1.15rem 1.25rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
  align-items: center;
}

.search-box {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
}

.search-box i {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-box input {
  width: 100%;
  padding: 0.7rem 0.85rem 0.7rem 2.4rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
}

.search-box input:focus {
  border-color: var(--ink);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

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

.data-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--mist);
  vertical-align: middle;
  font-size: 0.925rem;
}

.data-table tbody tr:hover {
  background: rgba(200, 107, 60, 0.04);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-active,
.badge-completed,
.badge-paid,
.badge-credit {
  background: #e8f6ee;
  color: var(--success);
}

.badge-pending,
.badge-quoted,
.badge-advanced,
.badge-partially-paid {
  background: #fff6e5;
  color: var(--warning);
}

.badge-payment-pending,
.badge-cancelled,
.badge-unpaid,
.badge-debit {
  background: #fef3f2;
  color: var(--danger);
}

.mobile-cards {
  display: grid;
  gap: 0.75rem;
}

.mobile-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.mobile-card .row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
}

.mobile-card .row:last-child {
  margin-bottom: 0;
}

.mobile-card .k {
  color: var(--muted);
  flex-shrink: 0;
}

.mobile-card .v {
  text-align: right;
  font-weight: 600;
  word-break: break-word;
}

.mobile-card .title {
  font-family: var(--font-display);
  font-weight: 650;
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

@media (min-width: 768px) {
  .mobile-only {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .desktop-only {
    display: none !important;
  }
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.pagination a,
.pagination span {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0 0.5rem;
}

.pagination .current {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .form-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(200, 107, 60, 0.15);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

body.nav-open {
  overflow: hidden;
}
