@import url('shared.css');

* {
  box-sizing: border-box;
}

body {
  font-family: var(--portal-font);
  margin: 0;
  padding: 0;
  background: var(--portal-bg);
  color: var(--portal-text);
}

.screen.hidden {
  display: none;
}

.card {
  background: var(--portal-card-bg);
  padding: 1.5rem;
  border-radius: var(--portal-radius);
  box-shadow: var(--portal-shadow);
}

#login-screen {
  padding: 2rem 1rem;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

p.muted {
  color: var(--portal-text-muted);
  margin: 0 0 1rem;
  font-size: 0.9375rem;
}

#login-screen .app {
  max-width: 400px;
  width: 100%;
}

#login-screen h1,
.case-status h2,
.installments h2 {
  font-family: var(--portal-heading-font);
  font-weight: 700;
  color: var(--portal-primary);
}
#login-screen h1 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
}

#login-screen p {
  margin: 0 0 1rem;
  color: var(--portal-text-muted);
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.field input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--portal-input-border);
  border-radius: var(--portal-radius-sm);
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--portal-radius-sm);
  border: none;
  font-size: 0.9375rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.btn-primary {
  background: var(--portal-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--portal-primary-hover);
}

.btn-secondary {
  background: var(--portal-secondary-bg);
  color: #374151;
}

.btn-secondary:hover {
  background: var(--portal-secondary-hover);
}

.errors {
  padding: 0.75rem;
  background: var(--portal-error-bg);
  border: 1px solid var(--portal-error-border);
  border-radius: var(--portal-radius-sm);
  color: var(--portal-error-text);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.errors.hidden {
  display: none;
}

.loading.hidden,
.empty.hidden {
  display: none;
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--portal-card-bg);
  border-radius: var(--portal-radius);
  box-shadow: var(--portal-shadow);
  padding: 1.25rem;
}

.modal-card h3 {
  margin: 0 0 0.5rem;
  font-family: var(--portal-heading-font);
  color: var(--portal-primary);
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.field select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--portal-input-border);
  border-radius: var(--portal-radius-sm);
  background: #fff;
}

.loading {
  color: #6b7280;
  padding: 1rem 0;
}

.greeting {
  font-weight: 500;
  margin: 0;
  color: var(--portal-text-muted);
}

#dashboard-screen .client-shell {
  min-height: 100vh;
}

.client-sidebar {
  background: var(--portal-card-bg);
  box-shadow: var(--portal-shadow);
  padding: 0.75rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

.client-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
}

.brand-logo {
  width: 100%;
  max-width: 180px;
  height: auto;
  max-height: 52px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}


.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-copy strong {
  font-size: 0.9rem;
  color: var(--portal-text);
}

.brand-copy small {
  font-size: 0.75rem;
  color: var(--portal-text-muted);
}

.client-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.client-nav-link {
  text-decoration: none;
  color: #374151;
  padding: 0.42rem 0.7rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.52rem;
}

.client-nav-link:hover {
  background: var(--portal-highlight-bg);
  color: var(--portal-highlight-text);
}

.client-ui-mode-field {
  margin: 0;
  min-width: 140px;
}

#dashboard-screen .client-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.case-status {
  margin-bottom: 1.5rem;
}

.case-status h2,
.installments h2 {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
}

#case-status-text {
  margin: 0;
  color: var(--portal-text-muted);
}

.installments-list {
  overflow-x: auto;
}

.installments-list table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.installments-list th,
.installments-list td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--portal-border);
}

.installments-list th {
  font-weight: 600;
  background: #f9fafb;
  color: #374151;
}

.installments-list tr.installment-next-due td {
  background: #fff;
  color: var(--portal-text);
  font-weight: 500;
}

.installments-list tr.installment-paid td {
  background: #fff;
  color: var(--portal-text);
}

.installments-list tr.installment-past-due td {
  background: #fff;
  color: var(--portal-text);
}

.installments-list .pay-link {
  color: var(--portal-primary);
  text-decoration: none;
}

.installments-list .pay-link:hover {
  text-decoration: underline;
}

.installments-list .status-badge {
  display: inline-block;
  padding: 0.23rem 0.58rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 0;
}

.status-badge.paid { background: #afe7ba; color: #155e31; }
.status-badge.processing { background: #f8dc86; color: #7a4d00; }
.status-badge.sent { background: #b8eee7; color: #0f5f57; }
.status-badge.open { background: #c8c5ff; color: #4338ca; }
.status-badge.due { background: #ffd89b; color: #8b3d00; }
.status-badge.past-due { background: #ffb9b9; color: #8f1d1d; }

.empty {
  color: #6b7280;
  padding: 1rem 0;
}

:root[data-ui-mode='modern'] body {
  background: #fff;
}

:root[data-ui-mode='modern'] #dashboard-screen .client-shell {
  display: flex;
}

:root[data-ui-mode='modern'] .client-sidebar {
  width: var(--portal-sidebar-width);
  min-height: 100vh;
  position: sticky;
  top: 0;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 1rem;
  border-right: 1px solid #eceff5;
  box-shadow: none;
  padding: 1rem 0.85rem;
  background: var(--portal-primary);
}

:root[data-ui-mode='modern'] .client-sidebar-head {
  gap: 0.55rem;
  background: #fff;
  border: 1px solid #eddfe6;
  border-radius: 0.95rem;
  padding: 0.65rem 0.7rem;
  min-height: 76px;
  overflow: hidden;
}

:root[data-ui-mode='modern'] .client-sidebar-head .brand-logo {
  max-width: 220px;
  max-height: 64px;
  transform: scale(2.1);
  transform-origin: center center;
}

:root[data-ui-mode='modern'] .greeting {
  margin: 0 0 0.2rem;
  color: rgba(255, 255, 255, 0.94);
}

:root[data-ui-mode='modern'] .client-nav {
  flex-direction: column;
  align-items: stretch;
}

:root[data-ui-mode='modern'] .client-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.68rem 0.8rem;
  font-weight: 500;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.96);
  border-radius: 0.75rem;
}

:root[data-ui-mode='modern'] .client-nav-link .nav-icon {
  width: 1rem;
  height: 1rem;
  color: rgba(255, 255, 255, 0.96);
}

:root[data-ui-mode='modern'] .client-nav-link:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
}

:root[data-ui-mode='modern'] .client-main {
  width: calc(100% - var(--portal-sidebar-width));
  max-width: none !important;
  padding: 1.1rem 1.25rem;
}

:root[data-ui-mode='modern'] .client-main > section {
  background: #f1f3f8;
  border: 1px solid #e4e8f0;
  border-radius: 1.2rem;
}

:root[data-ui-mode='modern'] .card {
  border: 1px solid #e5e8ef;
  box-shadow: var(--portal-card-shadow);
  border-radius: var(--portal-radius);
  padding: var(--portal-card-padding);
}

:root[data-ui-mode='modern'] #logout-link {
  margin-top: auto;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  color: var(--portal-primary);
  border: 0;
}

@media (max-width: 980px) {
  .client-sidebar {
    flex-wrap: wrap;
  }

  :root[data-ui-mode='modern'] #dashboard-screen .client-shell {
    display: block;
  }

  :root[data-ui-mode='modern'] .client-sidebar {
    width: 100%;
    min-height: 0;
    position: static;
    flex-direction: row;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--portal-border);
    overflow-x: auto;
  }

  :root[data-ui-mode='modern'] .client-main {
    width: 100%;
    padding: 1rem;
  }

  :root[data-ui-mode='modern'] .client-nav {
    flex-direction: row;
  }

  :root[data-ui-mode='modern'] .client-main > section {
    border-radius: 1rem;
  }
}
