:root {
  color-scheme: light;
  --ink: #172b3d;
  --muted: #687887;
  --line: #dfe6ec;
  --paper: #f5f7f9;
  --white: #ffffff;
  --forest: #102a43;
  --forest-2: #173a5e;
  --mint: #b89255;
  --gold-soft: #f6f0e7;
  --danger: #b42318;
  font-family: Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
}

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

button, input, a { -webkit-tap-highlight-color: transparent; }

::selection { background: var(--mint); color: var(--forest); }

.shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr);
}

.brand-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 6vw, 88px);
  color: #fff;
  background: linear-gradient(180deg, var(--forest), #0c2237);
}

.brand-panel::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  inset: auto -170px -190px auto;
  border: 1px solid rgba(184, 146, 85, .28);
  border-radius: 50%;
  box-shadow: 0 0 0 58px rgba(184, 146, 85, .04), 0 0 0 116px rgba(184, 146, 85, .035);
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 14px;
  padding: 3px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(6,21,34,.28);
}

.brand-mark img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }

.brand-copy { position: relative; z-index: 1; max-width: 610px; }
.company { color: var(--mint); font-size: 15px; font-weight: 700; }
.brand-copy h1 { margin: 18px 0 24px; font-size: clamp(40px, 5vw, 72px); line-height: 1.12; letter-spacing: -.035em; }
.brand-copy > p:last-child { margin: 0; max-width: 55ch; color: #c9d4de; font-size: clamp(16px, 1.4vw, 20px); line-height: 1.9; }

.trust-line { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; color: #c9d4de; font-size: 14px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(184,146,85,.13); }

.access-panel { display: grid; place-items: center; padding: clamp(24px, 5vw, 72px); }
.access-card { width: min(100%, 440px); }
.access-card header { margin-bottom: 34px; }
.login-logo { display: block; width: min(100%, 300px); height: auto; margin: 0 0 20px auto; object-fit: contain; }
.product-name { margin: 0 0 16px; color: var(--mint); font-size: 14px; font-weight: 800; }
.access-card h2 { margin: 0 0 10px; font-size: 32px; letter-spacing: -.025em; }
.access-card header > p:last-child { margin: 0; color: var(--muted); line-height: 1.7; }

form { display: grid; gap: 10px; }
label { margin-top: 8px; font-size: 14px; font-weight: 700; }
input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
input::placeholder { color: #7b8985; }
input:focus { border-color: var(--forest-2); box-shadow: 0 0 0 4px rgba(23,58,94,.1); }
textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink); outline: none; }
textarea { min-height: 96px; padding: 13px 16px; resize: vertical; line-height: 1.7; }
select { padding: 0 12px; }
textarea:focus, select:focus { border-color: var(--forest-2); box-shadow: 0 0 0 4px rgba(23,58,94,.1); }

.phone-field { position: relative; }
.phone-field span { position: absolute; left: 16px; top: 17px; color: var(--muted); font-size: 14px; pointer-events: none; }
.phone-field input { padding-left: 70px; text-align: left; }

.primary-button, .secondary-button {
  width: 100%;
  min-height: 54px;
  margin-top: 8px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: background 180ms ease, transform 100ms ease, opacity 180ms ease;
}
.text-button { margin-top: 18px; padding: 6px 0; border: 0; background: transparent; color: var(--forest-2); cursor: pointer; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.primary-button { border: 0; background: var(--forest); color: var(--white); }
.primary-button:hover { background: var(--forest-2); }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.primary-button:focus-visible, .secondary-button:focus-visible { outline: 3px solid rgba(184,146,85,.4); outline-offset: 3px; }
.primary-button:disabled { cursor: wait; opacity: .65; }
.secondary-button { border: 1px solid var(--line); background: var(--white); color: var(--forest); }
.secondary-button:hover { background: #eaf0ee; }

.form-error { min-height: 22px; margin: 2px 0 0; color: var(--danger); font-size: 13px; line-height: 1.6; }
.support-note { margin: 24px 0 0; color: var(--muted); font-size: 13px; line-height: 1.8; }

.account-details { margin: 0 0 24px; border-block: 1px solid var(--line); }
.account-details div { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 0; }
.account-details div + div { border-top: 1px solid var(--line); }
.account-details dt { color: var(--muted); }
.account-details dd { margin: 0; font-weight: 800; }
.ready-state { display: grid; gap: 7px; padding: 18px; border-radius: 12px; background: var(--gold-soft); color: var(--forest); }
.ready-state span { color: #68583f; font-size: 14px; line-height: 1.7; }

.workspace-mode .shell { display: block; }
.workspace-mode .brand-panel { display: none; }
.workspace-mode .access-panel { display: block; min-height: 100dvh; padding: 0; background: var(--paper); }
.dashboard { width: 100%; min-height: 100dvh; padding: 30px clamp(20px, 5vw, 70px) 70px; }
.workspace-header { display: grid; grid-template-columns: 220px 1fr auto; align-items: center; gap: 28px; max-width: 1280px; margin: 0 auto 30px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.workspace-header img { width: 210px; height: auto; }
.workspace-header p { margin: 0 0 4px; color: var(--mint); font-size: 13px; font-weight: 800; }
.workspace-header h2 { margin: 0; font-size: 25px; }
.workspace-user { display: flex; align-items: center; gap: 12px; }
.workspace-user > span { padding: 8px 11px; border-radius: 10px; background: var(--gold-soft); color: #765e38; font-size: 13px; font-weight: 800; }
.workspace-user .secondary-button { min-height: 42px; margin: 0; padding: 0 15px; white-space: nowrap; }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 1280px; margin: 0 auto 20px; }
.summary-grid article { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: 0 5px 18px rgba(16,42,67,.04); }
.summary-grid span { display: block; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.summary-grid strong { color: var(--forest); font-size: 25px; font-variant-numeric: tabular-nums; }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 1280px; margin: 0 auto 20px; }
.workspace-panel { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); box-shadow: 0 5px 18px rgba(16,42,67,.04); }
.workspace-panel h3 { margin: 0 0 6px; font-size: 19px; }
.workspace-panel > p, .panel-heading p { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.workspace-panel form { gap: 8px; }
.workspace-panel input, .workspace-panel select { height: 46px; }
.workspace-panel .primary-button { min-height: 48px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row > div { display: grid; gap: 8px; }
.activation-result { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 15px; border-radius: 12px; background: var(--gold-soft); color: #6d5737; }
.activation-result span { font-size: 13px; }
.activation-result strong { color: var(--forest); font-size: 24px; letter-spacing: 3px; }

.employees-panel { max-width: 1280px; margin: 0 auto; }
.invoice-create-panel, .invoices-panel { max-width: 1280px; margin: 0 auto 20px; }
.invoice-create-panel form { max-width: 760px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0 !important; }
.capture-actions { display: grid; grid-template-columns: 1.2fr .8fr; gap: 10px; }
.camera-action, .file-action { display: grid; gap: 5px; margin: 0; padding: 20px; border-radius: 13px; cursor: pointer; text-align: center; transition: background 180ms ease, border-color 180ms ease; }
.camera-action { border: 1px solid var(--forest); background: var(--forest); color: #fff; }
.camera-action:hover { background: var(--forest-2); }
.file-action { border: 1px dashed #a9b8c4; background: #f8fafb; color: var(--forest); }
.file-action:hover { border-color: var(--forest-2); background: #f2f6f8; }
.camera-action span { color: #c9d4de; }
.file-action span, .upload-hint { color: var(--muted); }
.camera-action span, .file-action span, .upload-hint { font-size: 12px; font-weight: 400; }
.upload-hint { margin: 0 0 4px; text-align: center; }
.file-preview { display: grid; gap: 7px; }
.file-chip { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 9px; background: var(--gold-soft); color: #6d5737; font-size: 12px; }
.invoice-list { display: grid; gap: 10px; }
.invoice-item { display: grid; grid-template-columns: minmax(180px, 1.25fr) minmax(140px, .7fr) auto; align-items: center; gap: 18px; padding: 16px 0; border-bottom: 1px solid #e8edf1; }
.invoice-item:last-child { border-bottom: 0; }
.invoice-main h4 { margin: 0 0 6px; color: var(--forest); font-size: 15px; }
.invoice-main p, .invoice-meta { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.invoice-amount { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.invoice-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.invoice-actions button, .invoice-file { min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--forest); cursor: pointer; font-weight: 700; text-decoration: none; }
.invoice-actions .approve { border-color: #176b43; background: #176b43; color: #fff; }
.invoice-actions .reject { color: var(--danger); }
.invoice-review-note { width: 100%; min-height: 42px; padding: 8px 10px; font-size: 12px; }
.status-approved { background: #e2f3eb; color: #176b43; }
.status-rejected { background: #fde8e7; color: #9b241b; }
.status-returned { background: #fff1d8; color: #795f36; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.panel-heading span { padding: 7px 10px; border-radius: 9px; background: var(--navy-soft, #eaf0f5); color: var(--forest); font-size: 12px; font-weight: 800; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 13px 10px; border-bottom: 1px solid #e8edf1; text-align: right; white-space: nowrap; }
th { color: #596b7a; background: #fafbfc; font-size: 12px; }
td { font-size: 14px; }
.status-badge { display: inline-block; padding: 5px 8px; border-radius: 8px; font-size: 12px; font-weight: 800; }
.status-active { background: #e2f3eb; color: #176b43; }
.status-pending { background: var(--gold-soft); color: #795f36; }
.empty-state { margin: 20px 0 0; padding: 28px; text-align: center; border: 1px dashed #cbd5dc; border-radius: 12px; color: var(--muted); }
.permissions-panel { max-width: 1280px; margin: 20px auto 0; }
.role-guide { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.role-guide span { padding: 12px; border-radius: 10px; background: #f7f9fa; color: var(--muted); font-size: 12px; line-height: 1.6; }
.role-guide strong { display: block; color: var(--forest); font-size: 13px; }
.role-select { min-width: 130px; height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.save-role { min-height: 38px; margin: 0; padding: 0 12px; border: 0; border-radius: 9px; background: var(--forest); color: #fff; cursor: pointer; font-weight: 700; white-space: nowrap; }
.save-role:disabled { opacity: .5; cursor: not-allowed; }

[hidden] { display: none !important; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: auto; padding: 24px; flex-direction: row; align-items: center; gap: 16px; }
  .brand-copy { flex: 1; }
  .company { margin: 0 0 5px; }
  .brand-copy h1 { margin: 0; font-size: 22px; line-height: 1.35; letter-spacing: -.02em; }
  .brand-copy > p:last-child, .trust-line, .brand-panel::after { display: none; }
  .brand-mark { width: 58px; height: 58px; flex: 0 0 58px; border-radius: 12px; }
  .access-panel { place-items: start center; padding: 38px 24px 48px; }
  .access-card header { margin-bottom: 26px; }
  .access-card h2 { font-size: 28px; }
  .dashboard { padding: 18px 16px 50px; }
  .workspace-header { grid-template-columns: 1fr auto; gap: 12px; margin-bottom: 20px; }
  .workspace-header img { width: 145px; }
  .workspace-header > div:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .workspace-header h2 { font-size: 21px; }
  .workspace-user { grid-column: 2; grid-row: 1; }
  .workspace-user > span { display: none; }
  .workspace-user .secondary-button { padding: 0 10px; font-size: 12px; }
  .summary-grid { grid-template-columns: 1fr; gap: 10px; }
  .summary-grid article { display: flex; align-items: center; justify-content: space-between; padding: 16px; }
  .summary-grid span { margin: 0; }
  .summary-grid strong { font-size: 20px; }
  .admin-grid { grid-template-columns: 1fr; }
  .workspace-panel { padding: 18px; }
  .form-row { grid-template-columns: 1fr; }
  .role-guide { grid-template-columns: 1fr 1fr; }
  .invoice-item { grid-template-columns: 1fr auto; }
  .invoice-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .capture-actions { grid-template-columns: 1fr; }
}

@media (max-width: 480px) { .role-guide { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
