:root {
  --navy: #0b1220;
  --navy-light: #141d31;
  --gold: #c9974a;
  --gold-light: #dfb46f;
  --cream: #f6efe2;
  --text-dim: #8b93a7;
  --border: #232d42;
  --ok: #4caf7d;
  --warn: #d4a13d;
  --err: #c0554a;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f3f4f6;
  color: #1a1f2b;
  margin: 0;
  min-height: 100vh;
}

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

/* logo mark used on login and in the sidebar */
.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--navy);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* soft, blurred logo watermark behind a page, purely decorative */
.bg-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 900px;
  height: 900px;
  transform: translate(-50%, -50%);
  background-image: url('/lengau-logo.png');
  background-size: cover;
  background-position: center;
  filter: blur(28px);
  opacity: 0.28;
  z-index: 0;
  pointer-events: none;
}

@media (max-width: 600px) {
  .bg-watermark { width: 500px; height: 500px; }
}

/* centered card layout, used by login.html */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  position: relative;
  z-index: 1;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-brand .name {
  font-weight: 700;
  font-size: 16px;
}

.auth-card h1 {
  font-size: 18px;
  margin: 0 0 6px;
}

.auth-card p {
  font-size: 13.5px;
  color: #6b7280;
  margin: 0 0 20px;
  line-height: 1.5;
}

input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 10px;
}

input:focus {
  outline: none;
  border-color: var(--gold);
}

select {
  width: 100%;
  padding: 11px 36px 11px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 10px;
  background-color: #fff;
  color: #1a1f2b;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.6' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 151, 74, 0.18);
}

button {
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: 8px;
  background: var(--navy);
  color: var(--gold-light);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

button:hover { background: var(--navy-light); }

#status {
  font-size: 12.5px;
  color: #6b7280;
  margin-top: 12px;
  min-height: 16px;
}

.site-footer {
  text-align: center;
  font-size: 11.5px;
  color: #9ca3af;
  padding: 20px;
}

/* ============================================================
   DASHBOARD SHELL — sidebar + main content, used by every signed-in
   page from here on (developer, main office, branch manager, etc.)
   ============================================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--navy);
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-sidebar .sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding: 0 4px;
}

.app-sidebar .sidebar-logo .name { font-weight: 700; font-size: 14.5px; }
.app-sidebar .sidebar-logo .sub { font-size: 10.5px; color: rgba(255,255,255,0.4); margin-top: 1px; }

.app-sidebar .sidebar-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.32);
  margin: 16px 8px 8px;
}

.app-sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.65);
  border-left: 3px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.app-sidebar .nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.app-sidebar .nav-item:hover svg,
.app-sidebar .nav-item.active svg {
  opacity: 1;
}

.app-sidebar .nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }

.app-sidebar .nav-item.active {
  background: rgba(201,151,74,0.16);
  color: var(--gold-light);
  border-left-color: var(--gold);
  font-weight: 600;
}

.app-sidebar .sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.app-sidebar .sidebar-signout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.app-sidebar .sidebar-signout:hover { color: #fff; background: rgba(255,255,255,0.05); }

.app-main {
  flex: 1;
  background: #f3f5f9;
  padding: 28px 32px 50px;
  min-width: 0;
}

.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.app-topbar h1 { font-size: 20px; margin: 0; color: var(--navy); font-weight: 700; }
.app-topbar .sub { font-size: 12px; color: #9ca3af; margin-top: 3px; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi {
  background: #fff;
  border: 1px solid #e6e9f0;
  border-radius: 12px;
  padding: 18px 20px;
}

.kpi .k-value { font-size: 26px; font-weight: 800; color: var(--navy); line-height: 1; margin-bottom: 6px; }
.kpi .k-label { font-size: 12px; color: #6b7386; }

.dash-panel {
  background: #fff;
  border: 1px solid #e6e9f0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.dash-panel .panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e6e9f0;
}

.dash-panel .panel-head h2 { font-size: 14.5px; margin: 0; color: var(--navy); font-weight: 700; }
.dash-panel .panel-body { padding: 20px; }

.dash-panel { overflow-x: auto; }

.dash-panel table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-panel th {
  text-align: left;
  padding: 10px 20px;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9aa1b3;
  border-bottom: 1px solid #e6e9f0;
}
.dash-panel td { padding: 12px 20px; border-bottom: 1px solid #f1f2f6; }
.dash-panel tbody tr:last-child td { border-bottom: none; }

.dash-form { padding: 4px 20px 20px; }
.dash-form input, .dash-form select { margin-bottom: 10px; }

/* ============================================================
   MOTION & FEEDBACK — loading spinners, toasts, smooth transitions.
   Used everywhere a button does something that takes a moment.
   ============================================================ */

button, input {
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

button:active:not(:disabled) { transform: scale(0.98); }

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(201, 151, 74, 0.18);
}

.btn-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2.5px solid rgba(201, 151, 74, 0.25);
  border-top-color: var(--gold-light);
  border-radius: 50%;
  animation: btn-spin 0.65s linear infinite;
  vertical-align: -3px;
  margin-right: 8px;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.spinner-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: btn-spin 0.65s linear infinite;
  vertical-align: -2px;
  margin-right: 8px;
}

button.is-loading {
  animation: btn-pulse 1.3s ease-in-out infinite;
}

@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 151, 74, 0.35); }
  50% { box-shadow: 0 0 0 7px rgba(201, 151, 74, 0); }
}

.toast {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 12px;
  animation: toast-in 0.2s ease;
}

.toast.show { display: flex; }
.toast.success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.toast.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.toast.info { background: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb; }

.toast .toast-icon { flex-shrink: 0; font-size: 13px; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .app-sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 14px 16px;
    gap: 16px;
    overflow-x: auto;
    overflow-y: visible;
  }
  .app-sidebar .sidebar-logo { margin-bottom: 0; flex-shrink: 0; }
  .app-sidebar .sidebar-label { display: none; }
  .app-sidebar .nav-item { white-space: nowrap; flex-shrink: 0; }
  .app-sidebar .sidebar-footer {
    margin-top: 0;
    margin-left: auto;
    padding-top: 0;
    border-top: none;
    flex-shrink: 0;
  }
  .app-main { padding: 20px 16px 40px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
