/*
  Copyright (c) 2026 Ken Turner Law. All rights reserved.
  Saddle — dense full-screen File & Bill. ADHD-first: no wasted space, actions always visible.
*/

html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.ios-shell {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: #f5f8fa;
}

/* —— Sign-in / Inbox (scroll whole panel) —— */
.inbox-panel,
.sign-in-panel {
  max-width: 560px;
  margin: 0 auto;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 10px 10px max(10px, env(safe-area-inset-bottom));
  padding-top: max(10px, env(safe-area-inset-top));
}

.sign-in-panel {
  height: auto;
  max-height: 100%;
  margin-top: 24px;
  margin-bottom: 24px;
}

.ios-header {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.ios-header h1 {
  font-size: 20px;
  margin: 0;
}

.ios-header p {
  margin: 2px 0 0;
  font-size: 13px;
}

.inbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 4px 0 8px;
}

.inbox-toolbar button {
  width: auto;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 14px;
}

.hide-billed,
.hide-ignored {
  margin: 0;
  flex: 1;
  font-size: 13px;
  min-width: 120px;
}

.ios-notice:not(:empty) {
  padding: 8px 10px;
  border-radius: 8px;
  background: #e8f4f1;
  color: #0b625a;
  margin: 0 0 8px;
  font-weight: 650;
  font-size: 13px;
}

.ios-notice.error {
  background: #fcebe8;
  color: #8a2f24;
}

.inbox-list {
  display: grid;
  gap: 6px;
}

.inbox-item {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #cdd6dc;
  background: white;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.inbox-item-main {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: grid;
  gap: 2px;
  min-height: 0 !important;
}

.inbox-item-main:active {
  background: #eef5f3;
}

.inbox-item-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  border-left: 1px solid #e0e6ea;
  background: #f7fafc;
}

.inbox-item-actions button {
  width: auto;
  min-height: 28px !important;
  padding: 4px 8px;
  font-size: 11px !important;
  font-weight: 700;
}

.inbox-item-actions .inbox-delete {
  color: #8a2f24;
  background: #fff4f2;
  border-color: #dba9a2;
}

.inbox-item .from {
  font-weight: 750;
  color: #172b3a;
  font-size: 14px;
}

.inbox-item .subject {
  font-weight: 650;
  color: #173a57;
  font-size: 14px;
}

.inbox-item .preview {
  color: #526470;
  font-size: 12px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.inbox-item .meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #6a7b88;
  font-size: 11px;
  font-weight: 650;
}

.inbox-item.billed {
  border-color: #9dceb0;
  background: #f3fbf6;
}

.inbox-item .badge {
  color: #12633a;
  font-weight: 800;
}

.inbox-item .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inbox-item .attachment-badge {
  color: #173a57;
}

.inbox-item .ignored-badge {
  color: #78530d;
}

.inbox-empty {
  padding: 20px 12px;
  text-align: center;
  color: #526470;
  font-weight: 650;
  font-size: 14px;
}

.ios-settings {
  margin-top: 14px;
  color: #526470;
  font-size: 13px;
}

.inbox-panel button {
  min-height: 40px;
  font-size: 15px;
}

/* —— Bill view: Read mode + expanding billing sheet —— */
.bill-panel {
  max-width: 560px;
  margin: 0 auto;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.bill-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  gap: 0;
  padding-top: max(6px, env(safe-area-inset-top));
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}

.back-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px !important;
  padding: 0;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  color: #173a57;
  background: #e8eef2;
  border-color: #cdd6dc;
}

.bill-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #f5f8fa;
  border-bottom: 1px solid #dce3e8;
}

.bill-subject {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  font-weight: 750;
  color: #173a57;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.read-status {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 8px;
  min-height: 0;
  font-size: 11px;
  font-weight: 700;
  color: #0b625a;
}

.read-status:empty {
  display: none;
}

.read-status.error {
  color: #8a2f24;
}

.email-reader {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  padding: 6px 10px;
  background: #fff;
}

.bill-shell.billing-open .email-reader {
  opacity: 0.45;
  pointer-events: none;
}

.email-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  color: #172b3a;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
  font-size: 15px;
}

.email-body-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 40dvh;
  border: 0;
  border-radius: 6px;
  background: #fff;
}

.attachments-section {
  flex: 0 0 auto;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e0e6ea;
}

.attachment-list {
  display: grid;
  gap: 6px;
}

.attachment-button {
  display: grid;
  gap: 1px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  background: #edf4f8;
  border: 1px solid #c6d6df;
  min-height: 0 !important;
}

.attachment-name {
  font-weight: 750;
  color: #173a57;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.attachment-size {
  font-size: 12px;
  color: #526470;
}

.read-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: start;
  padding: 8px;
  background: #f0f4f7;
  border-top: 1px solid #cdd6dc;
  z-index: 2;
}

.read-bar .primary {
  min-height: 44px !important;
  font-size: 16px !important;
  font-weight: 750;
}

#open-eservice-docs:not([hidden]) {
  grid-column: 1 / -1;
  min-height: 40px;
  color: #173a57;
  background: #e7f2f6;
  border-color: #9db8c7;
}

.more-menu {
  position: relative;
}

.more-menu > summary {
  list-style: none;
  cursor: pointer;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid #cdd6dc;
  border-radius: 9px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  color: #173a57;
}

.more-menu > summary::-webkit-details-marker {
  display: none;
}

.more-menu-actions {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  display: grid;
  gap: 4px;
  min-width: 180px;
  padding: 6px;
  border: 1px solid #cdd6dc;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  z-index: 5;
}

.more-menu-actions button {
  width: 100%;
  min-height: 36px !important;
  font-size: 13px !important;
}

.billing-sheet {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.billing-sheet[hidden] {
  display: none !important;
}

.billing-sheet-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(23, 58, 87, 0.28);
  min-height: 0 !important;
}

.billing-sheet-panel {
  position: relative;
  z-index: 1;
  max-height: 68dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px max(12px, env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 16px 16px 0 0;
  border-top: 2px solid #173a57;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
  display: grid;
  gap: 6px;
}

.billing-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.billing-sheet-header h2 {
  margin: 0;
  font-size: 18px;
  color: #173a57;
}

.billing-sheet-panel #notice:not(:empty),
.billing-sheet-panel #email-status:not(:empty) {
  margin: 0;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
}

.billing-date {
  margin: 0;
  font-size: 10px;
  color: #526470;
  font-weight: 650;
}

.billing-description {
  display: block;
  margin: 0 !important;
}

.billing-description textarea {
  min-height: 44px;
  font-size: 14px;
  margin-top: 2px;
  padding: 7px 8px;
  resize: vertical;
}

.match-banner {
  margin: 0;
  padding: 5px 7px;
  border-radius: 6px;
  background: #fff7e6;
  border: 1px solid #e6c98a;
  color: #7a4b00;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.match-banner.confident {
  background: #e8f4f1;
  border-color: #9dceb0;
  color: #0b625a;
}

.billing-matter {
  display: block;
  margin: 0 !important;
  font-size: 12px;
}

.matter-match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 32px;
  gap: 4px;
  align-items: center;
}

.matter-match-row .match-banner {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matter-match-row #accept-match,
.matter-match-row #refresh-matters {
  min-height: 32px !important;
  padding: 3px 7px !important;
  font-size: 12px !important;
}

.matter-match-row #accept-match {
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-lite {
  background: #e8f4f1 !important;
  border-color: #9dceb0 !important;
  color: #0b625a !important;
}

.eservice-docs {
  display: grid;
  gap: 4px;
}

.eservice-summary {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  color: #173a57;
}

.billing-sheet-panel label {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
}

.billing-sheet-panel select,
.billing-sheet-panel input,
.billing-sheet-panel textarea {
  min-height: 38px;
  font-size: 15px;
  margin-top: 2px;
  padding: 7px 9px;
}

.billing-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) 64px;
  align-items: end;
}

.billing-hours input {
  width: 100%;
  text-align: center;
}

.nonbillable-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin: 0 !important;
  padding: 6px 8px;
  border: 1px solid #cdd6dc;
  border-radius: 8px;
  background: #f7fafc;
  font-size: 13px;
}

.nonbillable-toggle input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.save-billed {
  width: 100%;
  min-height: 46px !important;
  font-size: 16px !important;
  font-weight: 750;
  margin-top: 2px;
}

.bill-panel .compact-button {
  min-height: 32px !important;
  width: auto;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 650;
}

.bill-panel #refresh-matters {
  width: 32px;
  min-width: 32px;
  margin: 0;
  padding: 0 !important;
  font-size: 16px !important;
}

.bill-panel .danger {
  color: #8a2f24;
  background: #fff4f2;
  border-color: #dba9a2;
}

.bill-panel button {
  min-height: 36px;
  font-size: 13px;
}

/* Reply / confirmation / e-service overlays */
.reply-card {
  width: min(100%, 420px);
  text-align: left;
}

.reply-card label {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.reply-card textarea {
  width: 100%;
  min-height: 140px;
  font-size: 16px;
}

.reply-recipients,
#reply-status {
  color: #526470;
  font-size: 14px;
  font-weight: 650;
  margin: 0;
}

.reply-buttons {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.eservice-overlay {
  align-items: stretch;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
}

.eservice-card {
  width: min(100%, 560px);
  margin: auto;
  max-height: 100%;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 2px solid #173a57;
  padding: 14px;
  display: grid;
  gap: 10px;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.35);
}

.eservice-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.eservice-card-header h2 {
  margin: 0;
  font-size: 18px;
  color: #173a57;
}

.eservice-progress,
.eservice-doc-label,
#eservice-status {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: #526470;
}

.eservice-viewer {
  position: relative;
  min-height: 220px;
  border: 1px solid #cdd6dc;
  border-radius: 10px;
  background: #f5f8fa;
  overflow: hidden;
}

.eservice-frame {
  display: block;
  width: 100%;
  height: min(42dvh, 360px);
  border: 0;
  background: #fff;
}

.eservice-viewer-fallback {
  display: grid;
  gap: 10px;
  place-items: center;
  padding: 24px 16px;
  text-align: center;
}

.eservice-viewer-fallback[hidden] {
  display: none;
}

.eservice-nav {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 6px;
}

.eservice-card label {
  margin: 0;
  font-size: 13px;
}

.eservice-card select {
  margin-top: 4px;
  min-height: 40px;
}

/* saddle8 */
