
:root {
  --navy: #142b45;
  --navy-light: #203c5c;
  --gold: #e2b653;
  --background: #f3f6fa;
  --white: #ffffff;
  --text: #1b2c40;
  --muted: #718096;
  --border: #e0e7ef;
  --green: #16815c;
  --amber: #a96d0d;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

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

.topbar {
  background: var(--navy);
  color: var(--white);
  padding: 18px clamp(16px, 4vw, 38px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: var(--navy);
  font-size: 24px;
  font-weight: 900;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .3px; }
.brand small { color: #d3dfeb; font-size: 11px; letter-spacing: 1.5px; }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

#onlineDot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
}

main {
  max-width: 1250px;
  margin: auto;
  padding: 26px clamp(14px, 3vw, 30px) 40px;
}

.welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.4px;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(26px, 4vw, 34px); }
h2 { font-size: 18px; margin-bottom: 8px; }
p { margin-bottom: 10px; }
.welcome p:not(.eyebrow), .section-heading p, .card > p { color: var(--muted); font-size: 13px; }

.date-card {
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  white-space: nowrap;
}

.quick-links, .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.quick-links { margin-bottom: 18px; }

.quick-links a, .footer-links a {
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.quick-links a { color: var(--navy-light); }
.quick-links a:hover, .footer-links a:hover {
  color: var(--amber);
  text-decoration: underline;
}

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

.card {
  min-width: 0;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 3px 12px #172c4210;
}

.stats .card > p { margin-bottom: 12px; font-size: 13px; }
.stats h2 { margin-bottom: 4px; font-size: clamp(21px, 2.5vw, 29px); overflow-wrap: anywhere; }
.card small { color: var(--muted); font-size: 11px; }
.green { color: var(--green); }
.amber { color: var(--amber); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(290px, 1fr);
  gap: 18px;
  align-items: start;
}

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

.table-wrap { width: 100%; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 13px 8px;
  border-bottom: 1px solid #edf1f5;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }

.stock-name { font-weight: 700; }
.stock-sku { display: block; color: var(--muted); font-size: 10px; }

.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
}
.pill.ok { background: #def6e9; color: #14774f; }
.pill.low { background: #fff0d5; color: #95600d; }

.side-column { display: grid; gap: 18px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.action {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 10px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
}

.action:hover { border-color: var(--gold); background: #fffaf0; }
.action b, .action small { display: block; }
.action b { font-size: 12px; }
.action small { margin-top: 3px; }

.button {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  background: var(--navy);
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button.gold { background: var(--gold); color: #202b38; }
.button.secondary { background: #eaf0f6; color: var(--navy); }
.button.whatsapp { background: #188653; color: white; }
.button.full { width: 100%; margin-top: 8px; }

#whatsapp-report label, .field label {
  display: block;
  margin: 12px 0 6px;
  font-size: 12px;
  font-weight: 800;
}

#ownerPhone, .field input, .field select {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #d3dce7;
  border-radius: 9px;
  background: white;
  color: var(--text);
}

#whatsappBtn { width: 100%; margin-top: 8px; }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.alerts { margin-top: 14px; }
.alert-item {
  padding: 9px 11px;
  margin-top: 8px;
  background: #fff7e8;
  border-radius: 9px;
  color: #86590c;
  font-size: 12px;
}

.activity-list { font-size: 12px; }
.activity-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: 0; }
.activity-item strong { display: block; }
.activity-item small { display: block; margin-top: 3px; }

.notice {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid #d8e4f1;
  border-radius: 12px;
  background: #eaf2fb;
  color: #37516d;
  font-size: 12px;
}

footer {
  padding: 22px 15px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}
.footer-links { justify-content: center; margin-bottom: 14px; }
.footer-links a { color: var(--navy-light); }
footer p { margin-bottom: 5px; }

dialog {
  width: min(460px, calc(100% - 24px));
  max-height: 85vh;
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 17px;
  color: var(--text);
  box-shadow: 0 20px 80px #0004;
}
dialog::backdrop { background: #081525aa; }
dialog h2 { margin-bottom: 6px; }
dialog p { color: var(--muted); font-size: 12px; }
.field { margin-bottom: 12px; }
.form-buttons { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  z-index: 10;
  transform: translateX(-50%);
  display: none;
  max-width: calc(100% - 24px);
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--navy);
  color: white;
  font-size: 12px;
}
.toast.show { display: block; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #5ea9ff;
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .topbar { padding: 14px; }
  .brand strong { font-size: 12px; }
  .brand small { font-size: 9px; }
  .logo { width: 38px; height: 38px; }
  .welcome { align-items: flex-start; flex-direction: column; }
  .date-card { white-space: normal; }
  .stats { gap: 9px; }
  .card { padding: 14px; }
  .action-grid { gap: 8px; }
  .action { padding: 10px 7px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
}

[hidden] {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f3f6fa;
}

.login-card {
  width: min(100%, 420px);
  padding: 28px;
  background: #fff;
  color: #17263a;
  border-radius: 18px;
  box-shadow: 0 12px 40px #142b4520;
}

.login-logo {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #d7a94b;
  color: #142b45;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 16px;
}

.login-card h1 {
  font-size: 21px;
  margin: 0;
}

.login-subtitle {
  margin: 4px 0 24px;
  color: #64748b;
  font-size: 12px;
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 23px;
}

.login-card form {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.login-card label {
  font-size: 13px;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid #d3dce7;
  border-radius: 9px;
  font: inherit;
  margin-bottom: 8px;
}

.login-card button {
  border: 0;
  border-radius: 9px;
  padding: 13px;
  background: #142b45;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

#loginMessage {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  color: #b42318;
}

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

.logout-btn {
  padding: 9px 14px;
  border: 1px solid #ffffff55;
  border-radius: 9px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.logout-btn:hover {
  background: #ffffff18;
}

.logout-btn:focus-visible {
  outline: 2px solid #d7a94b;
  outline-offset: 3px;
}

@media (max-width: 480px) {
  .header-actions {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .logout-btn {
    padding: 8px 10px;
    font-size: 12px;
  }
}
