/* Design tokens ported from app/[lang]/globals.css + tailwind.config.ts */
:root {
  --klar-navy: hsl(226, 66%, 11%);
  --klar-teal: hsl(188, 86%, 28%);
  --klar-cyan: hsl(187, 76%, 68%);
  --klar-yellow: hsl(48, 91%, 70%);
  --primary: hsl(188, 86%, 28%);
  --background: hsl(210, 20%, 98%);
  --border: hsl(214, 32%, 91%);
  --muted: hsl(215, 16%, 47%);
  --radius: 0.5rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: hsl(222, 47%, 11%);
  background: var(--background);
}

h1 { font-size: 1.5rem; font-weight: 600; }
h2 { font-size: 1.15rem; font-weight: 600; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); font-size: 0.85rem; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
  background: #fff;
  border-right: 1px solid var(--border);
  display: none;
  flex-direction: column;
  padding: 0.75rem;
  z-index: 10;
}
.sidebar-logo { padding: 0.5rem 0.75rem 1.5rem; }
.sidebar-logo img { max-width: 100px; max-height: 60px; object-fit: contain; }
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: hsl(215, 16%, 65%);
}

.main-menu { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.menu-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.menu-link:hover { background: hsl(210, 20%, 96%); color: hsl(222, 47%, 11%); }
.menu-link.active {
  background: hsl(188, 86%, 28%, 0.1);
  color: var(--primary);
  font-weight: 600;
}
.menu-icon { width: 18px; text-align: center; }

.language-switcher { display: flex; gap: 0.4rem; padding: 0.5rem 0.75rem; color: var(--muted); }
.language-switcher a.active { color: var(--primary); font-weight: 600; }

.content-column { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  gap: 0.75rem;
}
.topbar-mobile-logo img { max-height: 40px; max-width: 80px; object-fit: contain; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }

.company-select {
  width: 240px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 0.6rem;
  background: #fff;
  font: inherit;
}

.avatar-menu { position: relative; }
.avatar-menu summary { list-style: none; cursor: pointer; }
.avatar-menu summary::-webkit-details-marker { display: none; }
.avatar-menu img { width: 38px; height: 38px; border-radius: 50%; display: block; }
.avatar-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  min-width: 180px;
  padding: 0.4rem;
  z-index: 30;
}
.avatar-dropdown-title { font-weight: 600; padding: 0.4rem 0.6rem; }
.avatar-dropdown a { display: block; padding: 0.45rem 0.6rem; border-radius: 6px; }
.avatar-dropdown a:hover { background: hsl(210, 20%, 96%); }

.main { flex: 1; padding: 1rem; }

@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .content-column { margin-left: 220px; }
  .topbar-mobile-logo { display: none; }
  .main { padding: 2rem; }
}

/* ---------- Dashboard ---------- */
.page-head {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
}
@media (min-width: 768px) { .page-head { flex-direction: row; align-items: center; } }

.year-picker { display: flex; gap: 0.5rem; }
.year-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.year-btn:hover { background: hsl(210, 20%, 97%); }
.year-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 1.25rem 0 1.5rem;
}
@media (min-width: 768px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.1rem 1.25rem;
}
.card-title { font-weight: 600; }
.card-subtitle { color: var(--muted); font-size: 0.8rem; margin-top: 0.15rem; }
.card-content { font-size: 1.6rem; font-weight: 700; margin-top: 0.75rem; }

/* ---------- Tables ---------- */
.table-filters { display: flex; flex-wrap: wrap; gap: 0.75rem; padding: 0.75rem 0; }
.table-filters input {
  flex: 0 1 320px;
  height: 40px;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: hsl(210, 20%, 98%); }
.th-sort { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 0.35rem 0.6rem; font: inherit; cursor: pointer; }
.empty-row { text-align: center; color: var(--muted); padding: 2.5rem 0 !important; }
.skeleton-row { background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.amount { font-weight: 500; }

.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0; }
.pager { display: flex; gap: 0.5rem; }

/* Status pills — colors match BillsTable */
.pill { display: inline-block; padding: 0.35rem 0.9rem; border-radius: 999px; color: #fff; font-weight: 600; font-size: 0.8rem; }
.pill-pending { background: #facc15; }
.pill-unpaid { background: #f97316; }
.pill-failed { background: #ef4444; }
.pill-paid { background: #16a34a; }

/* ---------- Buttons / forms ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: hsl(188, 86%, 24%); }
.btn-navy { background: var(--klar-navy); color: #fff; border-radius: 12px; }
.btn-navy:hover:not(:disabled) { background: hsl(226, 66%, 16%); }
.btn-outline { background: #fff; border-color: var(--border); }
.btn-outline:hover:not(:disabled) { background: hsl(210, 20%, 96%); }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 500; margin-bottom: 0.35rem; }
.field input[type="text"], .field input[type="tel"], .field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--klar-cyan); border-color: var(--primary); }
.field-hint { color: var(--muted); font-size: 0.8rem; margin: 0.3rem 0 0; }
.field-error { color: #ef4444; font-size: 0.8rem; margin: 0.3rem 0 0; }

/* ---------- Dialog ---------- */
.dialog {
  border: none;
  border-radius: calc(var(--radius) + 6px);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
  padding: 1.5rem;
  width: min(480px, 92vw);
}
.dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.dialog-actions { display: flex; justify-content: space-between; margin-top: 1rem; }

/* ---------- Tabs (documents) ---------- */
.tab-list { display: inline-flex; gap: 0.25rem; background: hsl(210, 20%, 94%); border-radius: var(--radius); padding: 0.25rem; margin: 1rem 0; }
.tab-trigger { border: none; background: transparent; padding: 0.45rem 0.9rem; border-radius: 6px; font: inherit; cursor: pointer; color: var(--muted); }
.tab-trigger.active { background: #fff; color: hsl(222, 47%, 11%); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1); font-weight: 600; }
.file-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--klar-cyan);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  margin: 0 0.75rem 1rem 0;
  background: #fff;
}
.file-link:hover { background: hsl(210, 20%, 97%); }

/* ---------- Profile ---------- */
.profile-head { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; }
.profile-avatar { width: 144px; height: 144px; border-radius: 50%; object-fit: cover; }
.profile-line { font-weight: 500; margin: 0.25rem 0; }

/* ---------- Sign-in ---------- */
.signin-shell { display: flex; flex-direction: column; min-height: 100vh; background: hsl(210, 40%, 98%); }
@media (min-width: 1024px) { .signin-shell { flex-direction: row; } }

.signin-info {
  background: var(--klar-navy);
  color: #fff;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
@media (min-width: 1024px) { .signin-info { width: 50%; padding: 4rem; } }
.signin-info-inner { max-width: 36rem; margin: 0 auto; display: flex; flex-direction: column; gap: 2rem; }
.signin-info h1 { font-size: 1.75rem; margin: 0 0 1rem; }
.signin-info h2 { font-size: 1.1rem; margin: 0 0 0.5rem; }
.signin-info p { color: rgba(255, 255, 255, 0.8); line-height: 1.6; margin: 0; }

.signin-form-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }
.signin-card {
  width: 100%;
  max-width: 28rem;
  background: #fff;
  border: 1px solid hsl(210, 40%, 96%);
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  padding: 2.5rem;
}
.signin-logo { display: flex; justify-content: center; }
.signin-logo img { max-height: 60px; max-width: 140px; object-fit: contain; }
.signin-card h2 { text-align: center; color: var(--klar-navy); margin: 1.5rem 0 0; }
.signin-form { margin-top: 2.5rem; }
.signin-waiting { margin-top: 2.5rem; text-align: center; }
.signin-waiting .muted { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: hsl(222, 47%, 11%);
  color: #fff;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
  z-index: 100;
}
.toast-error { background: #ef4444; }

.company-information { line-height: 1.6; }
