/* ===================================================
   Lean Counsel — Portal Styles
   Sidebar layout, dashboard, tables, messages, login
   =================================================== */

/* --- Layout --- */
.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.portal-sidebar {
  width: 260px;
  background: var(--dark);
  padding: 32px 24px;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.portal-sidebar__back {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 32px;
  display: block;
  transition: color 0.2s ease;
}

.portal-sidebar__back:hover {
  color: var(--paper);
}

.portal-sidebar__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--paper);
  margin-bottom: 40px;
  display: block;
}

.portal-sidebar__nav {
  flex: 1;
}

.portal-sidebar__item {
  display: block;
  padding: 12px 16px;
  border-left: 3px solid transparent;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--dim);
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.portal-sidebar__item:hover {
  color: var(--paper);
}

.portal-sidebar__item--active {
  border-left-color: var(--accent);
  color: var(--paper);
  font-weight: 500;
}

.portal-sidebar__user {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 20px;
  margin-top: 20px;
}

.portal-sidebar__user-name {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--paper);
  margin-bottom: 4px;
}

.portal-sidebar__user-role {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 16px;
}

.portal-sidebar__signout {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--dim);
  transition: color 0.2s ease;
}

.portal-sidebar__signout:hover {
  color: var(--paper);
}

/* --- Content Area --- */
.portal-content {
  margin-left: 260px;
  padding: 40px;
  flex: 1;
  background: var(--paper);
  min-height: 100vh;
}

/* --- Header --- */
.portal-header {
  margin-bottom: 40px;
}

.portal-header__greeting {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--dim);
  margin-bottom: 4px;
}

.portal-header__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  color: var(--ink);
}

.portal-header__date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
  margin-top: 4px;
}

/* --- Cards Grid --- */
.portal-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 48px;
}

.portal-card {
  background: var(--white);
  border: 1px solid var(--rule);
  padding: 24px;
}

.portal-card__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 4px;
}

.portal-card__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
}

/* --- Activity List --- */
.portal-activity {
  margin-bottom: 48px;
}

.portal-activity__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 20px;
}

.portal-activity__item {
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.portal-activity__text {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
}

.portal-activity__time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
}

/* --- Quick Actions --- */
.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.portal-actions__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 20px;
  width: 100%;
}

/* --- Table --- */
.portal-table {
  width: 100%;
  border-collapse: collapse;
}

.portal-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  text-align: left;
  padding: 12px 12px;
  border-bottom: 2px solid var(--rule);
}

.portal-table td {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 16px 12px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
}

.portal-table tr:hover td {
  background: var(--gold-light);
}

/* --- Status Pills --- */
.portal-status {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 100px;
  white-space: nowrap;
}

.portal-status--active {
  background: #F3EEEE;
  color: var(--olive);
}

.portal-status--complete {
  background: var(--paper);
  color: var(--dim);
}

.portal-status--hold {
  background: var(--gold-light);
  color: var(--gold);
}

/* --- Documents --- */
.portal-docs {
  margin-top: 24px;
}

.portal-docs__section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--dim);
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--rule);
  margin-top: 24px;
}

.portal-docs__section-title:first-child {
  margin-top: 0;
}

.portal-doc {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
  transition: background 0.2s ease;
  cursor: pointer;
}

.portal-doc:hover {
  background: var(--gold-light);
  padding-left: 8px;
  padding-right: 8px;
}

.portal-doc__icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: var(--paper);
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dim);
}

.portal-doc__info {
  display: flex;
  flex-direction: column;
}

.portal-doc__name {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.portal-doc__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
}

/* --- Filter Bar --- */
.portal-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.portal-filter__btn {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 16px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: all 0.2s ease;
}

.portal-filter__btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.portal-filter__btn--active {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

/* --- Messages Layout --- */
.portal-messages {
  display: flex;
  height: calc(100vh - 120px);
  border: 1px solid var(--rule);
  background: var(--white);
}

/* Conversation List */
.portal-conversations {
  width: 320px;
  border-right: 1px solid var(--rule);
  overflow-y: auto;
}

.portal-conversation {
  padding: 16px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.portal-conversation:hover {
  background: var(--gold-light);
}

.portal-conversation--active {
  background: var(--gold-light);
}

.portal-conversation__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.portal-conversation__name {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.portal-conversation__time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
}

.portal-conversation__preview {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-conversation__badge {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  position: absolute;
  top: 20px;
  right: 16px;
}

/* Thread */
.portal-thread {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.portal-thread__header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--rule);
}

.portal-thread__name {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}

.portal-thread__messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Bubbles */
.portal-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
}

.portal-bubble--received {
  background: var(--white);
  border: 1px solid var(--rule);
  align-self: flex-start;
}

.portal-bubble--sent {
  background: var(--accent);
  color: var(--white);
  align-self: flex-end;
}

.portal-bubble__time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  margin-top: 4px;
}

.portal-bubble--sent .portal-bubble__time {
  color: rgba(255, 255, 255, 0.6);
}

/* Compose */
.portal-compose {
  border-top: 1px solid var(--rule);
  padding: 16px;
  display: flex;
  gap: 12px;
}

.portal-compose__input {
  flex: 1;
  border: 1px solid var(--rule);
  padding: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  border-radius: 4px;
  resize: none;
  outline: none;
}

.portal-compose__input:focus {
  border-color: var(--accent);
}

.portal-compose__send {
  background: var(--accent);
  color: var(--white);
  border: none;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: filter 0.2s ease;
}

.portal-compose__send:hover {
  filter: brightness(0.9);
}

/* ===================================================
   LOGIN PAGE
   =================================================== */
.portal-login {
  min-height: 100vh;
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.portal-login__card {
  background: var(--white);
  padding: 48px;
  max-width: 400px;
  width: 100%;
}

.portal-login__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  text-align: center;
  margin-bottom: 32px;
  color: var(--ink);
}

.portal-login__field {
  margin-bottom: 20px;
}

.portal-login__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  margin-bottom: 8px;
}

.portal-login__input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--rule);
  font-family: var(--font-body);
  font-size: 15px;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s ease;
}

.portal-login__input:focus {
  border-color: var(--accent);
}

.portal-login__btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--dark);
  border: none;
  padding: 14px 32px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 8px;
  transition: filter 0.2s ease;
}

.portal-login__btn:hover {
  filter: brightness(0.9);
}

.portal-login__forgot {
  text-align: center;
  margin-top: 16px;
}

.portal-login__forgot a {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--dim);
  transition: color 0.2s ease;
}

.portal-login__forgot a:hover {
  color: var(--accent);
}

.portal-login__back {
  text-align: center;
  margin-top: 32px;
}

.portal-login__back a {
  font-family: var(--font-body);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.2s ease;
}

.portal-login__back a:hover {
  color: var(--paper);
}

/* --- Mobile Header (hidden on desktop) --- */
.portal-mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--dark);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99;
}

.portal-mobile-header__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--paper);
}

.portal-mobile-header__toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.portal-mobile-header__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--paper);
}

/* ===================================================
   RESPONSIVE — Tablet (768px)
   =================================================== */
@media (min-width: 768px) {
  .portal-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .portal-header__title {
    font-size: 32px;
  }
}

/* ===================================================
   RESPONSIVE — Below 768px (Mobile)
   =================================================== */
@media (max-width: 767px) {
  .portal-sidebar {
    position: fixed;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
  }

  .portal-sidebar.is-open {
    transform: translateX(0);
  }

  .portal-content {
    margin-left: 0;
    padding: 80px 20px 40px;
  }

  .portal-mobile-header {
    display: flex;
  }

  /* Messages mobile */
  .portal-messages {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 120px);
  }

  .portal-conversations {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    max-height: 300px;
  }

  .portal-thread {
    min-height: 400px;
  }

  .portal-bubble {
    max-width: 90%;
  }

  /* Table to card layout */
  .portal-table,
  .portal-table thead,
  .portal-table tbody,
  .portal-table th,
  .portal-table td,
  .portal-table tr {
    display: block;
  }

  .portal-table thead {
    display: none;
  }

  .portal-table tr {
    border: 1px solid var(--rule);
    margin-bottom: 12px;
    padding: 16px;
    background: var(--white);
  }

  .portal-table td {
    border-bottom: none;
    padding: 4px 0;
    font-size: 13px;
  }

  .portal-table td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--dim);
    display: block;
    margin-bottom: 2px;
  }
}

/* ===================================================
   RESPONSIVE — Desktop (1200px)
   =================================================== */
@media (min-width: 1200px) {
  .portal-cards {
    grid-template-columns: repeat(4, 1fr);
  }

  .portal-content {
    padding: 48px 56px;
  }
}
