:root {
  --bg: #f4f7fc;
  --panel: #ffffff;
  --panel-soft: #f8faff;
  --text: #1a2333;
  --muted: #71809a;
  --line: #dce5f2;
  --brand: #3b82f6;
  --brand-dark: #1f63d6;
  --success: #0f9f5b;
  --danger: #d13b57;
  --warning: #d68a00;
  --shadow: 0 10px 30px rgba(23, 32, 51, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: all 0.2s;
}

a:hover {
  /* color: var(--brand); */
  /* text-decoration: underline; */
  opacity: 0.9;
}

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 24px;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #f9fbff;
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
}

.brand-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-nav a {
  color: #324562;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
}

.sidebar-nav a:hover {
  background: #edf4ff;
  color: #1f63d6;
}

.sidebar-nav a.is-active {
  background: linear-gradient(135deg, #66a8ff, #3b82f6);
  color: #fff;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.28);
}

.sidebar-logout {
  margin-top: auto;
}

.sidebar-logout .btn {
  width: 100%;
}

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

.top-strip {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.top-search {
  width: 220px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: #f8fbff;
}

.content-wrap {
  padding: 22px;
}

.topbar {
  background: #111827;
  color: #fff;
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 20px;
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 10px;
}

.nav a {
  color: #fff;
  background: rgba(255, 255, 255, .15);
  padding: 7px 12px;
  border-radius: 999px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: 18px;
}

.h1 {
  font-size: clamp(22px, 2vw, 30px);
  margin: 0 0 12px;
}

.row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.col {
  flex: 1;
  min-width: 260px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 10px 0 6px;
}

input[type=text],
input[type=email],
input[type=password],
input[type=date],
input[type=number],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus,
.top-search:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, .15);
}

textarea {
  min-height: 110px;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  vertical-align: top;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table th {
  background: var(--panel-soft);
  text-align: left;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 0;
  font-weight: 600;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}

.btn:hover {
  background: var(--brand-dark);
}

.btn.secondary {
  background: #334155;
}

.btn.danger {
  background: var(--danger);
}

.btn:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #f3f7ff;
}

.badge.ok {
  color: var(--success);
}

.badge.warn {
  color: var(--warning);
}

.badge.danger {
  color: var(--danger);
}

.flash {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff8dd;
  margin-top: 14px;
}

.flash.success {
  background: #e9fff1;
  border-color: #a8e4be;
}

.flash.error {
  background: #ffeaee;
  border-color: #f0b2be;
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.metric-grid.dashboard-secondary-grid{
  margin-top: 14px;
}
.metric-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: linear-gradient(180deg, #fff, #f9fbff);
}

.metric-value {
  font-size: 32px;
  font-weight: 700;
  margin: 6px 0 2px;
  color: #0f172a;
}

.metric-sub {
  font-size: 13px;
  color: var(--muted);
}

.highlight-card {
  margin-top: 14px;
  border: 1px solid #cfe0ff;
  border-radius: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #eff6ff, #e0ecff);
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .top-strip {
    position: static;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }
}

.invoice-actions{
  margin-top: 25px;
  margin-bottom: 25px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.purchase-invoice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

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

.purchase-invoice-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f8fbff);
  padding: 14px;
}

.purchase-invoice-card-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}

.purchase-invoice-main {
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 10px;
}

.purchase-invoice-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.purchase-invoice-list div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  border-bottom: 1px dashed #d8e1ef;
  padding-bottom: 6px;
}

.purchase-invoice-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.purchase-invoice-list dt {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.purchase-invoice-list dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.purchase-invoice-list--totals dd {
  font-size: 18px;
}

.purchase-invoice-extra {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--panel-soft);
  display: grid;
  gap: 10px;
}

.purchase-invoice-extra-item p {
  margin: 4px 0 0;
}

@media (max-width: 1080px) {
  .purchase-invoice-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .purchase-invoice-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .purchase-invoice-list div {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .purchase-invoice-list dd {
    text-align: left;
  }
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-logo {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

.auth-btn{
  border-radius:10px;
  font-weight:700;
  letter-spacing:.3px;
  text-transform:uppercase;
  font-size:12px;
  padding:10px 14px;
}

.auth-btn-secondary{
  background:#fff;
  color:#324562;
  border:1px solid #c6d4e8;
}

.auth-btn-secondary:hover{
  background:#f6f9ff;
}

.auth-btn-danger{
  background:var(--danger);
}

.auth-btn-danger:hover{
  filter:brightness(.96);
}

 