:root {
  --ink: #17201b;
  --muted: #68756d;
  --line: #dfe5de;
  --panel: #ffffff;
  --bg: #f4f7f1;
  --brand: #1f6f4a;
  --brand-dark: #12472f;
  --gold: #d6a83d;
  --danger: #b63d32;
  --green: #2e7d50;
  --blue: #315f8c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

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

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  min-height: 42px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus,
.search-select-input:focus {
  border-color: rgba(31, 111, 74, .55);
  box-shadow: 0 0 0 4px rgba(31, 111, 74, .12);
  outline: none;
}

input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

input[readonly] {
  background: #eef3ed;
  font-weight: 700;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

label input,
label select,
label textarea {
  color: var(--ink);
  font-weight: 400;
}

.native-select-hidden {
  display: none !important;
}

.search-select {
  position: relative;
}

.search-select::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.search-select-input {
  padding-right: 38px;
}

.search-select-list {
  position: absolute;
  z-index: 20;
  inset: calc(100% + 6px) 0 auto 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(23, 32, 27, .16);
}

.search-select-list[hidden] {
  display: none;
}

.search-select-option {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  display: block;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.search-select-option:hover,
.search-select-option:focus {
  background: #eef5ef;
  outline: none;
}

.search-select-empty {
  padding: 10px;
  color: var(--muted);
  font-weight: 600;
}

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

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

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

td small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  background: #11271d;
  color: #fff;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand,
.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 800;
  line-height: 1.2;
}

.brand-block.center {
  justify-content: center;
  text-align: center;
  flex-direction: column;
}

.falcon-mark {
  width: 66px;
  height: 66px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand), var(--gold));
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 16px 32px rgba(18, 71, 47, 0.22);
}

.falcon-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.falcon-mark svg {
  width: 78%;
  height: 78%;
  fill: #fff;
}

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

.sidebar nav a {
  padding: 11px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.78);
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.sidebar-user {
  margin-top: auto;
  display: grid;
  gap: 7px;
  color: rgba(255,255,255,.72);
}

.sidebar-user a {
  color: #fff;
  font-weight: 700;
}

.content {
  margin-left: 250px;
  padding: 28px;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

.panel,
.table-wrap,
.login-panel,
.install-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(34, 49, 40, .08);
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.narrow {
  max-width: 560px;
}

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

.table-wrap.panel {
  padding: 18px;
}

.table-wrap.panel table {
  min-width: 680px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.one {
  grid-template-columns: 1fr;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin-bottom: 0;
}

.new-customer-box {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.new-customer-box[hidden] {
  display: none;
}

.items-list {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.item-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.75);
}

.product-select-field {
  grid-column: 1 / -1;
  padding-right: 48px;
}

.icon-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 999px;
  border-color: #f1c6c1;
  background: #fff;
  color: var(--danger);
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
}

.icon-button:hover {
  background: #fdeceb;
}

.deduction-toggle {
  margin: 6px 0 16px;
}

.totals-grid {
  align-items: end;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 600;
}

.check input {
  width: 18px;
  min-height: 18px;
}

.button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.button.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.button.tiny {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.button.wide {
  width: 100%;
}

.form-actions,
.toolbar,
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar {
  margin-bottom: 16px;
}

.toolbar input {
  max-width: 420px;
}

.report-filter {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(180px, 260px) 1fr;
  gap: 14px;
  align-items: end;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions form {
  display: inline-flex;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}

.stat strong {
  font-size: 25px;
}

.stat.accent {
  border-color: rgba(214, 168, 61, .7);
  background: #fff8e7;
}

.stat.green {
  border-color: rgba(46, 125, 80, .35);
}

.stat.red {
  border-color: rgba(182, 61, 50, .35);
}

.split {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 18px;
  align-items: start;
}

.badge {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge.income {
  background: #e8f5ee;
  color: var(--green);
}

.badge.expense {
  background: #fdeceb;
  color: var(--danger);
}

.notice {
  padding: 12px;
  border-radius: 8px;
  margin: 14px 0;
  font-weight: 700;
}

.notice.success {
  color: var(--green);
  background: #e8f5ee;
}

.notice.danger {
  color: var(--danger);
  background: #fdeceb;
}

.login-page,
.install-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(rgba(244, 247, 241, .9), rgba(244, 247, 241, .9)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='120' viewBox='0 0 180 120'%3E%3Cpath fill='%23d6a83d' fill-opacity='.18' d='M0 86c30-21 60-21 90 0s60 21 90 0v34H0z'/%3E%3Cpath fill='%231f6f4a' fill-opacity='.10' d='M0 28c30 18 60 18 90 0s60-18 90 0v28c-30-18-60-18-90 0S30 74 0 56z'/%3E%3C/svg%3E");
}

.login-panel,
.install-panel {
  width: min(460px, 100%);
  padding: 28px;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 4px;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
  }

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

  .sidebar nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-grid,
  .calc-grid,
  .item-row,
  .report-filter,
  .stats-grid,
  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .page-title,
  .form-actions,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .sidebar nav {
    grid-template-columns: 1fr 1fr;
  }

  h1 {
    font-size: 23px;
  }
}
