/* ============================================================
   CLIENT PORTAL (portal.html)
   Markup for cards/tables/documents is rendered by js/portal.js —
   class names unchanged.
   ============================================================ */

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}

.dashboard-page {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.dashboard-sidebar {
  position: relative;
  width: 272px;
  flex: none;
  display: flex;
  flex-direction: column;
  color: #FFFFFF;
  background:
    radial-gradient(18rem 14rem at 100% 0%, rgba(201, 164, 76, 0.14), transparent 70%),
    linear-gradient(180deg, var(--navy-dark), #08162F);
  transition: transform 0.35s var(--ease);
  z-index: 1000;
}

/* closing double rule on the sidebar edge */
.dashboard-sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 5px;
  border-left: 1px solid rgba(201, 164, 76, 0.45);
  border-right: 1px solid rgba(201, 164, 76, 0.45);
  pointer-events: none;
}

.sidebar-header {
  padding: 1.4rem 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: #FFFFFF;
}

/* logo on a white plate */
.sidebar-header a {
  display: inline-flex;
  padding: 0.6rem 0.9rem;
  background: #FFFFFF;
  border-radius: 14px;
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.7);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.75rem;
  overflow-y: auto;
}

.sidebar-nav ul { margin: 0; padding: 0; }
.sidebar-nav li { margin-bottom: 0.3rem; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.76);
  font-weight: 500;
  font-size: 0.97rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-link:hover { background: rgba(255, 255, 255, 0.07); color: #FFFFFF; }

.sidebar-link.active {
  background: rgba(201, 164, 76, 0.15);
  color: var(--gold-light);
  box-shadow: inset 0 0 0 1px rgba(201, 164, 76, 0.38);
}

.sidebar-footer {
  padding: 1.25rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
  min-width: 0;
}

.user-avatar {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--gold-light), var(--gold));
  color: var(--navy-dark);
  font-weight: 700;
}

.user-name {
  min-width: 0;
  font-weight: 600;
  font-size: 0.95rem;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  width: 100%;
  min-height: 42px;
  padding: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius-full);
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.logout-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.5); color: #FFFFFF; }

/* ── Main ───────────────────────────────────────────────────── */
.dashboard-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.dashboard-header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 2rem;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}

.dashboard-header h1 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  color: var(--navy);
}

.dashboard-date {
  margin-top: 0.15rem;
  color: var(--gray-500);
  font-size: 0.9rem;
}

.mobile-toggle {
  display: none;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  background: var(--navy);
  color: var(--gold-light);
  font-size: 1.3rem;
  line-height: 1;
}

.dashboard-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.dashboard-section { display: none; max-width: 1180px; }

.dashboard-section.active {
  display: block;
  animation: fadeIn 0.35s var(--ease);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.dashboard-section .section-title {
  margin-bottom: 1.1rem;
  font-size: 1.3rem;
  letter-spacing: -0.015em;
}

/* branch picker (business accounts) */
.selection-controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.control-item { flex: 1; min-width: 220px; }

/* ── Overview cards ─────────────────────────────────────────── */
.overview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1.25rem;
  margin-bottom: 2.25rem;
}

.overview-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.4rem 1.5rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--gray-300);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), translate var(--transition);
}

.overview-card:hover { translate: 0 -3px; box-shadow: var(--shadow-md); }

.overview-card.card-danger  { border-left-color: var(--danger); }
.overview-card.card-warning { border-left-color: var(--warning); }
.overview-card.card-success { border-left-color: var(--success); }
.overview-card.card-info    { border-left-color: var(--gold); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--gray-600);
  font-size: 0.92rem;
  font-weight: 600;
}

.card-amount {
  margin: 0.2rem 0 0.35rem;
  font-size: 2.15rem;
  font-weight: 500;
  line-height: 1.1;
  color: var(--navy);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  color: var(--gray-500);
  font-size: 0.85rem;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-responsive {
  margin-bottom: 1.75rem;
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.obligations-table { width: 100%; min-width: 34rem; }

.obligations-table th,
.obligations-table td {
  padding: 0.95rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.obligations-table th {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-500);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.obligations-table td { color: var(--gray-700); font-variant-numeric: tabular-nums; }
.obligations-table td strong { color: var(--navy); }
.obligations-table tbody tr { transition: background-color 0.15s ease; }
.obligations-table tbody tr:hover { background: var(--gray-50); }
.obligations-table tbody tr:last-child td { border-bottom: 0; }

/* ── Status badges ──────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.8rem;
  border-radius: var(--radius-full);
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-pending { background: var(--danger-bg);  color: var(--danger-ink); }
.badge-paid    { background: var(--success-bg); color: var(--success-ink); }
.badge-warning { background: var(--warning-bg); color: var(--warning-ink); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-ink); }

/* ── Total of active obligations ────────────────────────────── */
.total-obligations-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: -0.5rem 0 2rem;
  padding: 1.4rem 1.75rem;
  background:
    radial-gradient(20rem 10rem at 100% 0%, rgba(201, 164, 76, 0.2), transparent 70%),
    var(--navy);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  color: #FFFFFF;
}

.total-obligations-card .total-label { font-size: 1.05rem; font-weight: 500; color: rgba(255, 255, 255, 0.86); }

/* the accountant's double underline under the total */
.total-obligations-card .total-amount {
  padding-bottom: 0.15rem;
  border-bottom: 4px double rgba(228, 203, 139, 0.9);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--gold-light);
}

/* ── Documents ──────────────────────────────────────────────── */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 1.25rem;
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.35rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition), translate var(--transition);
}

.doc-card:hover { border-color: rgba(201, 164, 76, 0.7); box-shadow: var(--shadow-md); translate: 0 -2px; }

.doc-header { display: flex; align-items: flex-start; gap: 0.9rem; min-width: 0; }

.doc-type-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 14px;
  background: linear-gradient(150deg, #FCF7E8 0%, #F4E8C4 100%);
  border: 1px solid rgba(201, 164, 76, 0.4);
}

.doc-info { flex: 1; min-width: 0; overflow: hidden; }

.doc-name {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-meta { color: var(--gray-500); font-size: 0.82rem; }

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

.portal-empty {
  padding: 3.5rem 2rem;
  background: var(--white);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-md);
  color: var(--gray-500);
  text-align: center;
}

.portal-empty-icon { margin-bottom: 0.75rem; font-size: 2.6rem; opacity: 0.6; }

/* ── Mobile sidebar backdrop ────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(6, 15, 34, 0.55);
  -webkit-backdrop-filter: blur(3px);
          backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.show { display: block; opacity: 1; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 992px) {
  .dashboard-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: min(290px, 86vw);
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }

  .dashboard-sidebar.show { transform: translateX(0); }

  .mobile-toggle { display: grid; flex: none; }

  .dashboard-header {
    justify-content: flex-start;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
  }

  .dashboard-header h1 { font-size: 1.15rem; line-height: 1.25; }
  .dashboard-content { padding: 1.25rem; }
}

@media (max-width: 768px) {
  .total-obligations-card { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .total-obligations-card .total-label { font-size: 1rem; }
  .total-obligations-card .total-amount { font-size: 1.7rem; }
}

@media (max-width: 576px) {
  .dashboard-header { padding: 0.75rem 1rem; gap: 0.75rem; }
  .dashboard-header h1 { font-size: 1.02rem; }
  .dashboard-content { padding: 1rem; }
  .card-amount { font-size: 1.9rem; }
}

/* ── Δόσεις Φόρου Εισοδήματος (accordion στον πίνακα ενεργών οφειλών) ── */
.tax-inst-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.25rem 0.5rem 0.25rem 0;
  background: none;
  border: 0;
  border-radius: var(--radius);
  color: var(--navy);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.tax-inst-toggle:focus-visible,
.tax-inst-view:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 2px; }

.tax-inst-chevron {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin: 0 0.4rem 0 0.1rem;
  border-right: 2px solid var(--gold-dark);
  border-bottom: 2px solid var(--gold-dark);
  rotate: -45deg;
  transition: rotate var(--transition-fast);
}

.tax-inst-toggle[aria-expanded="true"] .tax-inst-chevron { rotate: 45deg; }

.tax-inst-meta {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--accent-bg);
  color: var(--gold-ink);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.obligations-table tbody tr.tax-inst-parent.is-open td { border-bottom-color: transparent; }

.obligations-table tbody tr.tax-inst-child td {
  background: var(--gray-50);
  font-size: 0.93rem;
}

.obligations-table tbody tr.tax-inst-child td:first-child { padding-left: 2.4rem; white-space: nowrap; }
.obligations-table tbody tr.tax-inst-child[hidden] { display: none; }

.tax-inst-branch { margin-right: 0.5rem; color: var(--gray-400); }
.tax-inst-no { color: var(--navy); font-weight: 600; }

.tax-inst-sub {
  display: block;
  margin-top: 0.1rem;
  color: var(--gray-500);
  font-size: 0.8rem;
  font-weight: 500;
}

.tax-inst-view[aria-expanded="false"] .tax-inst-view-hide,
.tax-inst-view[aria-expanded="true"] .tax-inst-view-show { display: none; }

.tax-inst-pay-inline { display: none; }

/* Στο κινητό ο πίνακας κυλά οριζόντια· το «Πληρωμή» κάθε δόσης εμφανίζεται στην πρώτη (πάντα ορατή) στήλη */
@media (max-width: 576px) {
  .obligations-table tbody tr.tax-inst-child td:first-child { padding-left: 1.6rem; }
  .tax-inst-child .tax-inst-pay-inline { display: flex; margin-top: 0.45rem; }
  .tax-inst-child .tax-inst-pay-col .btn { display: none; }
}
