:root {
  --paper: #f3efe5;
  --paper-deep: #e9e1d2;
  --ink: #17282a;
  --muted: #6f7976;
  --green: #123f42;
  --green-soft: #d5e3de;
  --orange: #e56b3f;
  --line: rgba(23, 40, 42, .14);
  --white: #fffdf8;
  --shadow: 0 24px 80px rgba(32, 53, 48, .14);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); font-family: "Avenir Next", "Trebuchet MS", sans-serif; background: radial-gradient(circle at 82% 4%, rgba(229,107,63,.16), transparent 29%), var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .22; z-index: 20; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E"); }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }
.login-story { padding: clamp(40px, 7vw, 110px); display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; background: var(--green); color: var(--white); }
.login-story::after { content: ""; position: absolute; width: 460px; height: 460px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; right: -130px; bottom: -150px; box-shadow: 0 0 0 80px rgba(255,255,255,.025), 0 0 0 160px rgba(255,255,255,.018); }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50% 50% 50% 12%; background: var(--orange); color: var(--white); font: 700 30px/1 "Iowan Old Style", "Palatino Linotype", serif; margin-bottom: 52px; }
.brand-mark.small { width: 34px; height: 34px; margin: 0; font-size: 19px; }
.eyebrow { margin: 0 0 10px; text-transform: uppercase; letter-spacing: .16em; font-size: 11px; font-weight: 700; color: var(--muted); }
.login-story .eyebrow { color: #9fc1b6; }
.login-story h1 { margin: 0; max-width: 700px; font: 500 clamp(52px, 7vw, 96px)/.94 "Iowan Old Style", "Palatino Linotype", serif; letter-spacing: -.055em; }
.lead { max-width: 600px; margin: 34px 0; color: #bfd0ca; font-size: 19px; line-height: 1.6; }
.story-note { display: flex; flex-wrap: wrap; gap: 10px; }
.story-note span { border: 1px solid rgba(255,255,255,.18); border-radius: 100px; padding: 9px 14px; font-size: 12px; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.auth-card { width: min(420px, 100%); animation: rise .6s ease both; }
.auth-card h2, .dialog-card h2, .panel h2 { margin: 0 0 28px; font: 500 34px/1.1 "Iowan Old Style", "Palatino Linotype", serif; }
label { display: grid; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
input, select { width: 100%; border: 1px solid var(--line); background: rgba(255,253,248,.72); color: var(--ink); border-radius: 12px; padding: 13px 14px; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18,63,66,.1); }
.primary-button { border: 0; border-radius: 13px; background: var(--orange); color: white; font-weight: 700; padding: 14px 18px; display: inline-flex; align-items: center; justify-content: space-between; gap: 28px; box-shadow: 0 10px 26px rgba(229,107,63,.25); transition: transform .2s, box-shadow .2s; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(229,107,63,.32); }
.primary-button.compact { padding: 11px 15px; box-shadow: none; }
.form-error { min-height: 18px; color: #a3372d; font-size: 12px; }

.app-layout { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 20px; display: flex; flex-direction: column; background: var(--green); color: white; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 42px; font: 600 22px "Iowan Old Style", "Palatino Linotype", serif; }
nav { display: grid; gap: 7px; }
.nav-item { border: 0; border-radius: 12px; padding: 13px 14px; display: grid; grid-template-columns: 30px 1fr; text-align: left; background: transparent; color: #9fc1b6; }
.nav-item span { font-size: 10px; padding-top: 3px; opacity: .65; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.09); }
.sidebar-foot { margin-top: auto; padding: 18px 10px 0; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-foot p { margin: 0 0 7px; color: #cde0da; font-size: 13px; }
.text-button { border: 0; padding: 0; background: none; color: var(--orange); font-weight: 700; }
.sidebar .text-button { color: #9fc1b6; font-size: 12px; }

.workspace { width: 100%; min-width: 0; padding: 36px clamp(24px, 5vw, 72px) 64px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 38px; }
.topbar h1 { margin: 0; font: 500 clamp(38px, 5vw, 62px)/1 "Iowan Old Style", "Palatino Linotype", serif; letter-spacing: -.04em; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.top-actions select { min-width: 220px; background: var(--white); }
.view { display: none; animation: rise .35s ease both; }
.view.active-view { display: block; }
.metric-grid { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 16px; }
.metric { min-height: 175px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,253,248,.68); display: flex; flex-direction: column; }
.hero-metric { background: var(--orange); color: white; border-color: transparent; }
.metric p { margin: 0; font-size: 13px; font-weight: 700; }
.metric strong { margin: auto 0 12px; font: 500 clamp(30px, 4vw, 46px)/1 "Iowan Old Style", "Palatino Linotype", serif; }
.metric small { color: var(--muted); }
.hero-metric small { color: rgba(255,255,255,.72); }
.dashboard-grid { display: grid; grid-template-columns: 1.7fr .8fr; gap: 16px; margin-top: 16px; }
.panel { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.panel-head h2 { margin-bottom: 10px; }
.pulse-panel { background: var(--green); color: white; }
.pulse-panel .eyebrow { color: #9fc1b6; }
.document-list { display: grid; }
.document-row { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.document-row:first-child { border-top: 0; }
.document-row strong { display: block; font-size: 13px; }
.document-row small { color: var(--muted); }
.status-bars { display: grid; gap: 20px; margin-top: 38px; }
.status-line div { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px; }
.bar { height: 7px; border-radius: 7px; overflow: hidden; background: rgba(255,255,255,.12); }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--orange); }
.status { display: inline-flex; border-radius: 100px; padding: 5px 9px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; background: var(--green-soft); color: var(--green); }
.status.draft { background: #e9e3d7; color: #716a5f; }
.status.cancelled { background: #f2d8d3; color: #8a3830; }
.status.paid { background: #d6e8da; color: #246237; }

.section-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.section-toolbar p { color: var(--muted); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 16px 18px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
tr:last-child td { border-bottom: 0; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.table-action { border: 0; background: transparent; color: var(--orange); font-weight: 700; }
.customer-grid { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 16px; }
.customer-card { min-height: 190px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.customer-card h3 { margin: 28px 0 7px; font: 500 23px/1.1 "Iowan Old Style", "Palatino Linotype", serif; }
.customer-card p { margin: 4px 0; color: var(--muted); font-size: 13px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green); font-weight: 800; }
.company-details { max-width: 900px; padding: 34px; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line); }
.company-details h2 { font: 500 34px "Iowan Old Style", "Palatino Linotype", serif; margin: 0 0 24px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.detail-grid p { margin: 5px 0 0; }

dialog { width: min(720px, calc(100% - 28px)); border: 0; padding: 0; border-radius: 24px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(9,30,31,.62); backdrop-filter: blur(7px); }
.dialog-card { padding: 30px; }
.wide-dialog { width: 100%; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); font-size: 24px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.line-item { display: grid; grid-template-columns: 2fr .7fr 1fr .7fr; gap: 10px; padding: 18px; margin: 6px 0 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.line-item label { margin: 0; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; padding: 13px 17px; border-radius: 12px; background: var(--green); color: white; box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.empty { padding: 30px 0; color: var(--muted); text-align: center; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 980px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-story { min-height: 52vh; }
  .app-layout { grid-template-columns: 78px 1fr; }
  .sidebar { padding-inline: 12px; }
  .brand > span:last-child, .nav-item:not(.active) { font-size: 0; }
  .nav-item { grid-template-columns: 1fr; text-align: center; padding: 13px 6px; }
  .nav-item span { font-size: 10px; }
  .sidebar-foot p { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .hero-metric { grid-column: 1 / -1; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .customer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .login-story { padding: 36px 26px; }
  .login-story h1 { font-size: 48px; }
  .login-panel { padding: 36px 24px; }
  .app-layout { display: block; padding-bottom: 70px; }
  .sidebar { position: fixed; z-index: 30; inset: auto 0 0; width: 100%; height: 64px; padding: 8px 14px; flex-direction: row; align-items: center; }
  .brand, .sidebar-foot { display: none; }
  nav { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); }
  .nav-item, .nav-item:not(.active) { display: block; font-size: 10px; text-align: center; padding: 8px 4px; }
  .nav-item span { display: block; }
  .workspace { padding: 24px 18px 42px; }
  .topbar { align-items: stretch; flex-direction: column; margin-bottom: 24px; }
  .top-actions { align-items: stretch; flex-direction: column; }
  .metric-grid, .customer-grid { grid-template-columns: 1fr; }
  .hero-metric { grid-column: auto; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .line-item { grid-template-columns: 1fr 1fr; }
  .line-item .description { grid-column: 1 / -1; }
  .dialog-card { padding: 22px; }
}

/* HOSTION corporate theme */
@font-face {
  font-family: "Hostion Poppins";
  src: url("/assets/hostion-poppins-800.woff2") format("woff2");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: "Hostion Roboto";
  src: url("/assets/hostion-roboto.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #f1f1f3;
  --paper-deep: #e4e3e7;
  --ink: #25064d;
  --muted: #6d6379;
  --green: #25064d;
  --green-soft: #eee8f5;
  --orange: #25064d;
  --violet: #25064d;
  --violet-mid: #6d4b8d;
  --violet-faint: #f4f0f8;
  --line: rgba(37, 6, 77, .13);
  --white: #fefeff;
  --shadow: 0 24px 70px rgba(37, 6, 77, .12);
  --radius: 26px;
}

body {
  color: var(--ink);
  font-family: "Hostion Roboto", Roboto, sans-serif;
  background:
    radial-gradient(circle at 88% 4%, rgba(37, 6, 77, .08), transparent 24%),
    linear-gradient(135deg, #f7f7f8 0%, #ececef 100%);
}

.grain {
  opacity: .13;
  background-image:
    linear-gradient(rgba(37, 6, 77, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 6, 77, .04) 1px, transparent 1px);
  background-size: 34px 34px;
}

.hostion-logo {
  display: block;
  object-fit: contain;
  object-position: center;
}

.login-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
  background: #ededee;
}

.login-story {
  min-height: 100vh;
  padding: clamp(42px, 7vw, 110px);
  color: var(--violet);
  background:
    linear-gradient(115deg, rgba(255,255,255,.52), rgba(255,255,255,.05)),
    #d8d8da;
  isolation: isolate;
}

.login-story::before {
  content: "H";
  position: absolute;
  z-index: -1;
  right: -3vw;
  bottom: -16vw;
  color: rgba(255,255,255,.31);
  font: 800 min(62vw, 760px)/.82 "Hostion Poppins", sans-serif;
  letter-spacing: -.12em;
}

.login-story::after {
  z-index: -1;
  width: min(42vw, 560px);
  height: min(42vw, 560px);
  right: -12vw;
  bottom: -15vw;
  border-color: rgba(37,6,77,.12);
  box-shadow: 0 0 0 70px rgba(255,255,255,.12), 0 0 0 140px rgba(37,6,77,.025);
}

.login-logo {
  width: 146px;
  height: 96px;
  margin: 0 0 clamp(42px, 7vh, 88px);
}

.login-story .eyebrow { color: var(--violet-mid); }

.login-story h1 {
  max-width: 760px;
  color: var(--violet);
  font: 800 clamp(50px, 6.6vw, 92px)/.96 "Hostion Poppins", sans-serif;
  letter-spacing: -.055em;
}

.lead {
  max-width: 620px;
  margin: 34px 0;
  color: #584d66;
  font-size: 18px;
  font-weight: 350;
  line-height: 1.65;
}

.story-note span {
  border-color: rgba(37, 6, 77, .18);
  background: rgba(255,255,255,.36);
  color: var(--violet);
  font-weight: 600;
}

.login-panel {
  background:
    radial-gradient(circle at 100% 0, rgba(37,6,77,.09), transparent 28%),
    var(--white);
}

.auth-card {
  width: min(430px, 100%);
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 34px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--shadow);
}

.auth-card h2,
.dialog-card h2,
.panel h2,
.company-details h2,
.customer-card h3 {
  color: var(--violet);
  font-family: "Hostion Poppins", sans-serif;
  font-weight: 800;
  letter-spacing: -.035em;
}

.eyebrow {
  color: var(--violet-mid);
  font-family: "Hostion Roboto", sans-serif;
  font-weight: 700;
  letter-spacing: .18em;
}

input,
select {
  border-color: rgba(37, 6, 77, .16);
  background: #f8f7fa;
  color: var(--violet);
  border-radius: 10px;
}

input:focus,
select:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(37, 6, 77, .09);
}

.primary-button {
  border-radius: 999px;
  background: var(--violet);
  box-shadow: 0 10px 28px rgba(37, 6, 77, .22);
}

.primary-button:hover {
  box-shadow: 0 15px 34px rgba(37, 6, 77, .3);
}

.text-button,
.table-action { color: var(--violet); }

.app-layout { grid-template-columns: 260px 1fr; }

.sidebar {
  width: 260px;
  padding: 22px 18px;
  color: var(--violet);
  background: rgba(254,254,255,.94);
  border-right: 1px solid var(--line);
  box-shadow: 12px 0 42px rgba(37,6,77,.05);
}

.brand {
  min-height: 106px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  padding: 0 12px 26px;
  color: var(--violet);
  font-family: "Hostion Poppins", sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .28em;
  text-transform: uppercase;
}

.sidebar-logo {
  width: 116px;
  height: 72px;
  margin-left: -8px;
  margin-bottom: -8px;
}

.nav-item {
  padding: 14px;
  color: #756780;
  font-weight: 600;
}

.nav-item:hover {
  color: var(--violet);
  background: var(--violet-faint);
}

.nav-item.active {
  color: white;
  background: var(--violet);
  box-shadow: 0 12px 24px rgba(37, 6, 77, .18);
}

.sidebar-foot {
  border-color: var(--line);
  color: var(--violet);
}

.sidebar-foot p { color: var(--violet); }
.sidebar .text-button { color: var(--violet-mid); }

.workspace {
  background:
    radial-gradient(circle at 92% 2%, rgba(37,6,77,.07), transparent 28%),
    #f1f1f3;
}

.topbar h1 {
  color: var(--violet);
  font-family: "Hostion Poppins", sans-serif;
  font-weight: 800;
  letter-spacing: -.05em;
}

.top-actions select {
  border-radius: 999px;
  background: white;
}

.metric,
.panel,
.table-wrap,
.customer-card,
.company-details {
  border-color: rgba(37,6,77,.1);
  background: rgba(254,254,255,.92);
  box-shadow: 0 16px 44px rgba(37,6,77,.055);
}

.metric { min-height: 182px; }

.metric strong {
  color: var(--violet);
  font-family: "Hostion Poppins", sans-serif;
  font-weight: 800;
  letter-spacing: -.045em;
}

.hero-metric {
  position: relative;
  overflow: hidden;
  color: white;
  background: var(--violet);
}

.hero-metric::after {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  right: -60px;
  bottom: -90px;
  border: 30px solid rgba(255,255,255,.08);
  border-radius: 50%;
}

.hero-metric strong { color: white; }
.hero-metric small { color: rgba(255,255,255,.68); }

.pulse-panel {
  background:
    radial-gradient(circle at 110% -5%, rgba(255,255,255,.18), transparent 35%),
    var(--violet);
}

.pulse-panel h2 { color: white; }
.pulse-panel .eyebrow { color: #cbbbdc; }
.bar { background: rgba(255,255,255,.14); }
.bar i { background: white; }

.status { background: #e7dff0; color: var(--violet); }
.status.draft { background: #eceaec; color: #6c6570; }
.status.cancelled { background: #f3dedd; color: #8a3830; }
.status.paid { background: #dfeee4; color: #28643b; }

th {
  color: var(--violet-mid);
  font-weight: 800;
}

tbody tr { transition: background .18s ease; }
tbody tr:hover { background: var(--violet-faint); }

.avatar {
  border-radius: 13px;
  background: var(--violet);
  color: white;
}

dialog {
  background: #f4f3f6;
  box-shadow: 0 30px 100px rgba(20,4,40,.28);
}

dialog::backdrop { background: rgba(25, 8, 45, .62); }
.icon-button { color: var(--violet); border-color: var(--line); }
.line-item { background: white; }
.toast { background: var(--violet); }
.document-actions { display: flex; justify-content: flex-end; gap: 12px; }
.issue-action { padding-left: 12px; border-left: 1px solid var(--line); }
.table-action:disabled { opacity: .45; cursor: wait; }

@media (max-width: 980px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-story { min-height: 56vh; }
  .login-story h1 { font-size: clamp(46px, 9vw, 72px); }
  .app-layout { grid-template-columns: 88px 1fr; }
  .sidebar { width: 88px; }
  .brand { align-items: center; padding-inline: 0; }
  .sidebar-logo { width: 68px; margin-left: 0; }
  .brand > span { display: none; }
}

@media (max-width: 680px) {
  .login-story { min-height: 50vh; padding: 32px 24px 48px; }
  .login-logo { width: 112px; height: 72px; margin-bottom: 30px; }
  .login-story h1 { font-size: 44px; }
  .lead { margin: 22px 0; font-size: 16px; }
  .login-panel { padding: 26px 18px 40px; }
  .auth-card { padding: 26px 22px; border-radius: 26px; }
  .sidebar { width: 100%; background: rgba(254,254,255,.97); border: 0; border-top: 1px solid var(--line); }
  .nav-item { color: #766b7e; }
  .nav-item.active { color: white; }
  .workspace { padding-top: 22px; }
}
