/* ==========================================================================
   DeveloperStudio Portal — UI stylesheet
   Accent is sampled from the Developer Studio logo (emerald green).
   ========================================================================== */

:root {
  --brand:        #10c97e;
  --brand-dark:   #0aa868;
  --brand-soft:   #e7fbf2;

  --ink:          #0f1b17;
  --ink-2:        #3d4b46;
  --ink-3:        #6b7a74;
  --line:         #e4eae7;
  --bg:           #f4f7f6;
  --surface:      #ffffff;

  --ok:           #0f9d63;
  --ok-soft:      #e6f8f0;
  --warn:         #b8730a;
  --warn-soft:    #fdf3e2;
  --danger:       #c8412f;
  --danger-soft:  #fdeceb;
  --info:         #2563a8;
  --info-soft:    #eaf2fc;

  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 1px 2px rgba(15, 27, 23, .05), 0 8px 24px -12px rgba(15, 27, 23, .16);
  --sidebar-w:    244px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.011em; color: var(--ink); }

code {
  font-family: var(--mono);
  font-size: .86em;
  background: #eef2f0;
  padding: 1px 6px;
  border-radius: 5px;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #0d1a15;
  color: #cfdcd6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.sidebar__brand img { display: block; width: 148px; height: auto; }

.sidebar__nav { padding: 14px 10px; overflow-y: auto; flex: 1; }

.nav-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #64786f;
  padding: 14px 10px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: #cfdcd6;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item.is-active { background: var(--brand); color: #04150e; font-weight: 600; }
.nav-item.is-active .nav-icon { opacity: 1; }
.nav-icon { width: 17px; height: 17px; flex: 0 0 17px; opacity: .78; }

.sidebar__foot {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 12.5px;
  color: #8fa39a;
}
.sidebar__foot a { color: #cfdcd6; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 19px; }
.topbar__sub { color: var(--ink-3); font-size: 13px; margin-top: 1px; }
.topbar__actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.content { padding: 24px 28px 56px; flex: 1; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 550;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, transform .05s ease;
}
.btn:hover { background: #f7faf9; text-decoration: none; border-color: #d3dcd8; }
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--brand); border-color: var(--brand); color: #04150e; }
.btn--primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

.btn--danger { color: var(--danger); border-color: #f0cfca; background: #fff; }
.btn--danger:hover { background: var(--danger-soft); border-color: #e5b4ad; }

.btn--sm { padding: 5px 10px; font-size: 12.5px; }
.btn--block { width: 100%; }

/* ==========================================================================
   Cards & panels
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card__head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card__head h3 { font-size: 14.5px; }
.card__head .muted { font-size: 12.5px; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }

.grid { display: grid; gap: 16px; }
/* Sized so the dashboard's six tiles land on one row on a laptop, and fold to
   three then two as the window narrows — never 5 + 1 orphan. */
.grid--kpi   { grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); }
.grid--2     { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--3     { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--form  { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid--split { grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 1024px) { .grid--split { grid-template-columns: 1fr; } }

.stack { display: flex; flex-direction: column; gap: 16px; }

/* KPI tile */
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 17px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--kpi-accent, var(--brand));
}
.kpi__label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  font-weight: 600;
}
.kpi__value {
  font-size: 25px;
  font-weight: 680;
  letter-spacing: -.02em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.kpi__meta { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }

.chart-wrap { position: relative; height: 280px; }
.chart-wrap--sm { height: 220px; }

/* ==========================================================================
   Tables
   ========================================================================== */

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

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.tbl th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: #fafcfb;
  white-space: nowrap;
}
table.tbl td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f4f2;
  vertical-align: middle;
}
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: #fafcfb; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tbl .actions { text-align: right; white-space: nowrap; }
table.tbl tfoot td {
  font-weight: 650;
  border-top: 2px solid var(--line);
  background: #fafcfb;
}

.row-title { font-weight: 600; color: var(--ink); }
.row-sub { font-size: 12.5px; color: var(--ink-3); }

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--ink-3);
}
.empty h4 { font-size: 15px; margin-bottom: 6px; }

/* ==========================================================================
   Badges, alerts, misc
   ========================================================================== */

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge--ok     { background: var(--ok-soft);     color: var(--ok); }
.badge--warn   { background: var(--warn-soft);   color: var(--warn); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info   { background: var(--info-soft);   color: var(--info); }
.badge--muted  { background: #eef2f0;            color: var(--ink-3); }

.alert {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  margin-bottom: 16px;
  font-size: 13.5px;
}
.alert--success { background: var(--ok-soft);     border-color: #bfe8d6; color: #0b5f3f; }
.alert--danger  { background: var(--danger-soft); border-color: #f2c9c3; color: #8f2b1e; }
.alert--warn    { background: var(--warn-soft);   border-color: #f0dcb6; color: #7d4f06; }
.alert--info    { background: var(--info-soft);   border-color: #c8dcf5; color: #1c4a80; }
.alert a { color: inherit; text-decoration: underline; }

.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.text-ok { color: var(--ok); }
.text-danger { color: var(--danger); }
.mt-0 { margin-top: 0; }
.mb-16 { margin-bottom: 16px; }

/* ==========================================================================
   Forms
   ========================================================================== */

.field { margin-bottom: 15px; }
.field > label,
.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.input, select.input, textarea.input {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid #d9e1dd;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(16, 201, 126, .16);
}
textarea.input { resize: vertical; min-height: 84px; }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7a74' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
}

.input-group { display: flex; align-items: stretch; }
.input-group__addon {
  display: flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid #d9e1dd;
  border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: #f4f7f6;
  color: var(--ink-3);
  font-size: 13.5px;
}
.input-group .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 6px;
  margin-top: 4px;
}
.form-actions--sticky {
  border-top: 1px solid var(--line);
  padding: 15px 18px;
  margin: 0;
  background: #fafcfb;
  border-radius: 0 0 var(--radius) var(--radius);
}

.filters {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.filters .field { margin-bottom: 0; }
.filters .input { min-width: 150px; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  cursor: pointer;
}
.check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg a {
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-2);
  background: #fff;
  border-right: 1px solid var(--line);
}
.seg a:last-child { border-right: 0; }
.seg a:hover { background: #f7faf9; text-decoration: none; }
.seg a.is-active { background: var(--brand); color: #04150e; }

/* Repeatable invoice line rows */
.items-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.items-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
}
.items-table td { padding: 6px 8px; border-bottom: 1px solid #f0f4f2; vertical-align: middle; }
.items-table .input { padding: 6px 9px; }
.items-table th.num, .items-table td.num { text-align: right; }
.row-del {
  border: 0; background: none; color: var(--ink-3); cursor: pointer;
  font-size: 17px; line-height: 1; padding: 4px 6px; border-radius: 6px;
}
.row-del:hover { color: var(--danger); background: var(--danger-soft); }

.totals { margin-left: auto; width: 320px; max-width: 100%; }
.totals__row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; font-size: 13.5px;
}
.totals__row + .totals__row { border-top: 1px solid #f0f4f2; }
.totals__row--grand {
  border-top: 2px solid var(--line);
  margin-top: 4px; padding-top: 12px;
  font-size: 17px; font-weight: 680;
}
.totals__row .num { font-variant-numeric: tabular-nums; }
.totals input.input { width: 110px; text-align: right; padding: 5px 9px; }

/* ==========================================================================
   Login & install screens
   ========================================================================== */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #e9fbf3 0%, var(--bg) 60%);
}
.auth-card {
  width: 100%;
  max-width: 396px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 24px 60px -28px rgba(15, 27, 23, .30);
}
.auth-logo { display: block; width: 176px; height: auto; margin: 0 auto 22px; }
.auth-title { font-size: 19px; text-align: center; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--ink-3); font-size: 13.5px; margin: 0 0 22px; }
.auth-foot { text-align: center; color: var(--ink-3); font-size: 12.5px; margin: 18px 0 0; }

.install-list { list-style: none; margin: 0 0 20px; padding: 0; }
.install-list li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 0; border-bottom: 1px solid #f0f4f2; font-size: 13.5px;
}
.install-list em { display: block; font-style: normal; color: var(--ink-3); font-size: 12.5px; }
.install-mark { font-weight: 700; }
.install-list li.is-ok  .install-mark { color: var(--ok); }
.install-list li.is-bad .install-mark { color: var(--danger); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .sidebar__nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .sidebar__nav .nav-label { display: none; }
  .nav-item { margin: 0; padding: 7px 11px; font-size: 13px; }
  .sidebar__foot { display: flex; justify-content: space-between; align-items: center; }
  .topbar { padding: 14px 16px; flex-wrap: wrap; }
  .content { padding: 16px 16px 48px; }
  .grid--split { grid-template-columns: 1fr; }
}
