:root {
  --blue: #1769e0;
  --blue2: #eaf2ff;
  --ink: #172033;
  --muted: #6c768b;
  --line: #e4e8f0;
  --bg: #f5f7fb;
  --green: #15966b;
  --orange: #e07818
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--ink)
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 26px 18px;
  display: flex;
  flex-direction: column
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 18px;
  padding: 0 8px 28px
}

.brand span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px
}

.sidebar nav {
  display: grid;
  gap: 7px
}

.nav {
  border: 0;
  background: transparent;
  color: #526078;
  text-align: left;
  padding: 12px 14px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600
}

.nav:hover,
.nav.active {
  background: var(--blue2);
  color: var(--blue)
}

.sidebar-note {
  margin-top: auto;
  background: var(--blue2);
  color: var(--blue);
  padding: 14px;
  border-radius: 10px;
  font-weight: 700
}

.sidebar-note small {
  font-weight: 500
}

main {
  margin-left: 240px;
  padding: 28px 34px;
  min-height: 100vh
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px
}

h1 {
  font-size: 28px;
  margin: 0
}

header p {
  margin: 5px 0 0;
  color: var(--muted)
}

h2 {
  font-size: 17px;
  margin: 0 0 18px
}

.primary,
.secondary {
  border: 0;
  border-radius: 8px;
  padding: 11px 17px;
  font-weight: 700;
  cursor: pointer
}

.primary {
  background: var(--blue);
  color: white
}

.primary:hover {
  background: #0d57c4
}

.secondary {
  background: var(--blue2);
  color: var(--blue)
}

.small {
  padding: 8px 11px;
  font-size: 13px
}

.full {
  width: 100%
}

.view {
  display: none
}

.view.active {
  display: block
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 20px
}

.stats article,
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 21px;
  box-shadow: 0 3px 12px rgba(27, 46, 94, .04)
}

.stats small {
  color: var(--muted);
  display: block;
  margin-bottom: 12px
}

.stats strong {
  font-size: 23px
}

.green {
  color: var(--green)
}

.orange {
  color: var(--orange)
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px
}

.panel-head h2 {
  margin: 0
}

.link {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-weight: 700
}

.form-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 20px
}

.fields {
  display: grid;
  gap: 15px
}

.fields.two {
  grid-template-columns: 1fr 1fr
}

.wide {
  grid-column: 1/-1
}

label {
  display: block;
  color: #4d5870;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d8deea;
  border-radius: 8px;
  padding: 10px 11px;
  margin-top: 6px;
  background: #fff;
  color: var(--ink);
  outline: none
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue2)
}

.item-head,
.item-row {
  display: grid;
  grid-template-columns: 1.8fr .55fr 1fr 1fr .6fr 1fr 32px;
  gap: 10px;
  align-items: center
}

.item-head {
  font-size: 12px;
  color: var(--muted);
  padding: 0 4px 8px
}

.item-row {
  border-top: 1px solid var(--line);
  padding: 10px 0
}

.item-row input,
.item-row select {
  margin: 0
}

.item-amount {
  text-align: right;
  font-weight: 700
}

.remove {
  border: 0;
  background: #fff0f0;
  color: #c83838;
  border-radius: 7px;
  height: 34px;
  cursor: pointer
}

.totals-grid {
  grid-template-columns: 1.5fr .8fr
}

.totals>div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0
}

.discount {
  display: flex;
  margin: 0;
  width: 150px
}

.discount input {
  margin: 0;
  border-radius: 8px 0 0 8px
}

.discount select {
  margin: 0;
  width: 65px;
  border-radius: 0 8px 8px 0
}

.totals .grand {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding: 17px 0;
  font-size: 18px
}

.search {
  width: 280px;
  margin: 0
}

table {
  border-collapse: collapse;
  width: 100%
}

th,
td {
  text-align: left;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase
}

.badge {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 20px;
  background: #fff1df;
  color: #b25d0a;
  font-size: 11px;
  font-weight: 700
}

.badge.paid {
  background: #e6f8f1;
  color: var(--green)
}

.badge.partially-paid {
  background: #edf2ff;
  color: #4a63bf
}

.actions button {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
  margin-right: 7px
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px
}

.customer-card {
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 10px
}

.customer-card strong {
  display: block
}

.customer-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px
}

.settings {
  max-width: 760px
}

dialog {
  border: 0;
  border-radius: 14px;
  width: min(470px, 92vw);
  padding: 0;
  box-shadow: 0 20px 70px #17203355
}

dialog::backdrop {
  background: #17203388
}

dialog form {
  padding: 24px
}

.icon {
  border: 0;
  background: transparent;
  font-size: 27px;
  cursor: pointer
}

#toast {
  position: fixed;
  right: 25px;
  bottom: 25px;
  background: #172033;
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: .2s;
  pointer-events: none
}

#toast.show {
  opacity: 1;
  transform: none
}

@media(max-width:900px) {
  .sidebar {
    width: 78px;
    padding: 20px 10px
  }

  .brand div,
  .sidebar-note,
  .nav {
    font-size: 0
  }

  .brand {
    padding: 0 8px 24px
  }

  .nav:before {
    font-size: 12px;
    content: attr(data-view)
  }

  main {
    margin-left: 78px;
    padding: 20px
  }

  .stats {
    grid-template-columns: 1fr 1fr
  }

  .form-grid,
  .totals-grid {
    grid-template-columns: 1fr
  }

  .item-head {
    display: none
  }

  .item-row {
    grid-template-columns: 1fr 1fr
  }

  .cards {
    grid-template-columns: 1fr 1fr
  }
}

@media(max-width:580px) {
  main {
    margin-left: 0;
    padding: 15px;
    padding-bottom: 85px
  }

  .sidebar {
    inset: auto 0 0 0;
    width: auto;
    height: 66px;
    z-index: 10;
    padding: 7px
  }

  .brand,
  .sidebar-note {
    display: none
  }

  .sidebar nav {
    display: flex;
    justify-content: space-around
  }

  .nav {
    padding: 10px 6px;
    text-align: center
  }

  header {
    align-items: flex-start
  }

  header .primary {
    padding: 10px
  }

  .stats {
    grid-template-columns: 1fr
  }

  .fields.two,
  .cards {
    grid-template-columns: 1fr
  }

  .item-row {
    grid-template-columns: 1fr
  }

  .item-amount {
    text-align: left
  }

  .search {
    width: 170px
  }
}

@media print {

  .sidebar,
  header,
  .view:not(.print-view),
  button {
    display: none !important
  }

  main {
    margin: 0;
    padding: 0;
    background: white
  }

  .print-invoice {
    display: block !important
  }

  .panel {
    box-shadow: none;
    border: 0
  }
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: linear-gradient(135deg, #0b3f8f, #1769e0 55%, #69a5f6);
  display: grid;
  place-items: center;
  padding: 20px
}

.login-screen.hidden {
  display: none
}

.login-card {
  width: min(410px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 34px;
  box-shadow: 0 25px 80px #06265a66
}

.login-card h1 {
  text-align: center;
  margin: 12px 0 4px
}

.login-card>p {
  text-align: center;
  color: var(--muted);
  margin: 0 0 25px
}

.login-card small {
  display: block;
  text-align: center;
  color: var(--muted);
  margin-top: 14px
}

.login-logo {
  width: 58px;
  height: 58px;
  border-radius: 17px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  margin: auto;
  font-size: 22px;
  font-weight: 900
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px
}

.header-actions span {
  color: var(--muted);
  font-size: 12px
}

.muted {
  color: var(--muted);
  font-size: 13px;
  margin: 5px 0
}

.wide-dialog {
  width: min(720px, 94vw)
}

#quotation-form {
  padding: 24px
}

#login-error {
  color: #c83838;
  text-align: center;
  font-size: 13px;
  margin-top: 10px
}

.badge.draft {
  background: #edf0f5;
  color: #586174
}

.badge.sent {
  background: #eaf2ff;
  color: #1769e0
}

.badge.approved {
  background: #e6f8f1;
  color: #15966b
}

.badge.rejected {
  background: #fff0f0;
  color: #c83838
}

.login-screen {
  background: #eef3fb;
  padding: clamp(12px, 3vw, 42px);
  overflow: auto
}

.auth-shell {
  width: min(1050px, 100%);
  min-height: 650px;
  background: #fff;
  border-radius: 26px;
  box-shadow: 0 30px 90px rgba(22, 53, 102, .22);
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow: hidden
}

.auth-welcome {
  position: relative;
  overflow: hidden;
  padding: 45px 52px;
  color: #fff;
  background: linear-gradient(145deg, #0d3d87, #1769e0 62%, #48a2ff);
  display: flex;
  flex-direction: column;
  justify-content: space-between
}

.auth-welcome:before,
.auth-welcome:after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: #ffffff12
}

.auth-welcome:before {
  width: 390px;
  height: 390px;
  right: -130px;
  bottom: -95px;
  border: 55px solid #ffffff0b
}

.auth-welcome:after {
  width: 190px;
  height: 190px;
  right: 45px;
  top: 115px
}

.welcome-brand {
  position: relative;
  z-index: 1;
  font-weight: 800;
  letter-spacing: 1px
}

.welcome-brand span {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #fff;
  color: var(--blue);
  margin-right: 10px
}

.auth-welcome>div,
.auth-welcome>small {
  position: relative;
  z-index: 1
}

.auth-welcome p:first-child {
  font-size: 12px;
  letter-spacing: 4px;
  opacity: .76
}

.auth-welcome h1 {
  font-size: clamp(54px, 7vw, 84px);
  line-height: .88;
  letter-spacing: -4px;
  margin: 15px 0 25px
}

.welcome-line {
  width: 85px;
  height: 6px;
  border-radius: 4px;
  background: #7bd6ff;
  margin-bottom: 24px
}

.welcome-copy {
  max-width: 390px;
  line-height: 1.7;
  opacity: .86
}

.auth-panel {
  padding: 45px clamp(30px, 5vw, 65px);
  display: flex;
  align-items: center
}

.auth-form {
  display: none;
  width: 100%;
  animation: authIn .28s ease
}

.auth-form.active {
  display: block
}

@keyframes authIn {
  from {
    opacity: 0;
    transform: translateX(12px)
  }

  to {
    opacity: 1;
    transform: none
  }
}

.auth-title small {
  color: var(--blue);
  font-weight: 800;
  letter-spacing: 2px
}

.auth-title h2 {
  font-size: 36px;
  margin: 7px 0 5px
}

.auth-title p {
  color: var(--muted);
  margin: 0 0 27px
}

.auth-form label {
  margin-bottom: 16px
}

.auth-form input,
.auth-form select {
  padding: 12px 13px;
  background: #f9fbfe
}

.input-wrap {
  position: relative
}

.input-wrap input {
  padding-right: 62px
}

.input-wrap>span,
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%)
}

.password-toggle {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer
}

.auth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -3px 0 19px
}

.remember {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0
}

.remember input {
  width: auto;
  margin: 0
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  cursor: pointer;
  font-weight: 700
}

.auth-submit {
  width: 100%;
  border: 0;
  background: linear-gradient(90deg, #1769e0, #398bf3);
  color: #fff;
  border-radius: 11px;
  padding: 13px 18px;
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 9px 20px #1769e033
}

.auth-switch {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 20px 0 10px
}

.auth-message {
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  color: var(--green);
  min-height: 16px
}

.auth-message.error {
  color: #c83838
}

.auth-form details {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 12px
}

.auth-form details summary {
  cursor: pointer
}

.auth-form details small {
  display: block;
  line-height: 1.7;
  margin-top: 7px
}

@media(max-width:760px) {
  .auth-shell {
    grid-template-columns: 1fr;
    min-height: auto
  }

  .auth-welcome {
    min-height: 230px;
    padding: 28px
  }

  .auth-welcome h1 {
    font-size: 48px;
    letter-spacing: -2px;
    margin: 8px 0 12px
  }

  .auth-welcome .welcome-copy {
    display: none
  }

  .auth-welcome>small {
    display: none
  }

  .auth-panel {
    padding: 30px 24px
  }

  .login-screen {
    align-items: start
  }

  .auth-title h2 {
    font-size: 30px
  }
}
