/* App-specific styles. theme.css handles the palette. */

.hidden { display: none !important; }
.error { color: var(--danger); margin-top: .5rem; font-size: .9rem; }

/* --- LOGIN ----------------------------------------------------- */
#login-view {
  min-height: 100vh;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--rose) 130%);
  padding: 1rem;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%; max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-card label {
  display: block; margin-bottom: 1rem;
  font-size: .85rem; color: var(--text-muted);
}
.login-card input { margin-top: .35rem; }

/* --- APP SHELL ------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 1.25rem;
  padding: .85rem 1.5rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.topnav { display: flex; gap: 1.2rem; }
.topnav a {
  color: var(--text-muted); padding: .35rem 0;
  border-bottom: 2px solid transparent;
}
.topnav a.active { color: var(--text); border-bottom-color: var(--accent); }
.topbar select { width: auto; padding: .35rem .5rem; font-size: .85rem; }
.topbar #who { font-size: .85rem; }
.topbar button { padding: .35rem .8rem; font-size: .85rem; }

/* --- DASHBOARD ------------------------------------------------- */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat .label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-family: var(--font-display); font-size: 2.5rem; color: var(--text); }
.stat .sub { font-size: .85rem; color: var(--text-muted); }

/* --- TRANSACTIONS LIST ----------------------------------------- */
.tx-list { display: flex; flex-direction: column; gap: .75rem; }
.tx-row {
  display: grid;
  grid-template-columns: 90px 1fr 140px 130px 100px;
  gap: 1rem; align-items: center;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: box-shadow .15s ease, transform .06s ease;
}
.tx-row:hover { box-shadow: var(--shadow); }
.tx-row .side {
  font-family: var(--font-display); font-size: 1.5rem;
  text-transform: capitalize;
  color: var(--accent);
}
.tx-row .addr { font-weight: 500; }
.tx-row .meta { font-size: .85rem; color: var(--text-muted); }
.tx-row .price { font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 700px) {
  .tx-row { grid-template-columns: 1fr; }
  .tx-row .price, .tx-row .meta { text-align: left; }
}

/* --- TRANSACTION DETAIL ---------------------------------------- */
.tx-header {
  display: grid; grid-template-columns: 1fr auto; gap: 1rem;
  padding: 1.5rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.tx-header h1 { font-size: 2rem; margin: 0; }
.tx-header .sub { color: var(--text-muted); }
.tx-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .tx-grid { grid-template-columns: 1fr; } }

.section h3 {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: 1rem; padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  position: relative;
  padding: .9rem 0 .9rem 2rem;
  border-left: 2px solid var(--border);
  margin-left: .5rem;
}
.timeline li::before {
  content: ''; position: absolute; left: -8px; top: 1.1rem;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border);
}
.timeline li.done::before { background: var(--success); border-color: var(--success); }
.timeline li.next::before { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 4px rgba(234,168,12,0.2); }
.timeline .title { font-weight: 500; }
.timeline .due { font-size: .85rem; color: var(--text-muted); }

.task { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: none; }
.task input[type='checkbox'] { width: 18px; height: 18px; flex-shrink: 0; }
.task.done .title { text-decoration: line-through; color: var(--text-muted); }
.task .due { font-size: .8rem; color: var(--text-muted); margin-left: auto; }
.task.overdue .due { color: var(--danger); font-weight: 500; }

/* --- CONTACTS -------------------------------------------------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.contact-card .kind {
  display: inline-block; padding: .15rem .55rem;
  background: var(--cloud); color: var(--text);
  border-radius: 999px; font-size: .75rem; margin-bottom: .5rem;
  text-transform: uppercase; letter-spacing: .04em;
}
.contact-card.preferred { border-color: var(--gold); }
.contact-card .name { font-weight: 500; font-size: 1.05rem; }
.contact-card .company { color: var(--text-muted); font-size: .85rem; }
.contact-card .links { margin-top: .65rem; display: flex; gap: .5rem; flex-wrap: wrap; font-size: .85rem; align-items: center; }

/* --- TASK ROW (extended) -------------------------------------- */
.task-text { flex: 1; }
.task-edit { padding: .2rem .55rem; font-size: .9rem; }

/* --- TIMELINE WITH CHECKBOX ----------------------------------- */
.timeline li {
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .9rem 0 .9rem 2rem;
}
.timeline li input[type='checkbox'] {
  width: 16px; height: 16px; flex-shrink: 0; margin-top: .15rem;
}
.timeline .ms-text { flex: 1; }

/* --- NEW TRANSACTION FORM ------------------------------------- */
#new-tx-form label { display: block; font-size: .85rem; color: var(--text-muted); }
#new-tx-form input, #new-tx-form select, #new-tx-form textarea { margin-top: .35rem; }
.span2 { grid-column: 1 / -1; }

/* --- DOCUMENTS ------------------------------------------------- */
.doc-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
}
.doc-row:last-child { border-bottom: none; }
.doc-info { flex: 1; min-width: 0; }
.doc-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row .btn { flex-shrink: 0; }

/* --- READ-ONLY MODE FOR CLIENTS ------------------------------- */
body.readonly-client .no-readonly { display: none !important; }

/* --- MODAL ---------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(16, 16, 86, 0.55);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  padding: 1rem;
  z-index: 100;
  animation: fade-in .12s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 540px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: pop-in .18s ease;
}
@keyframes pop-in {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal-head {
  display: flex; align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 1.3rem; flex: 1; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.5rem; line-height: 1; padding: 0 .25rem; cursor: pointer;
}
.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: .85rem;
}
.modal-body label {
  display: block; font-size: .85rem; color: var(--text-muted);
}
.modal-body label.check {
  display: flex; align-items: center; gap: .4rem;
  flex-direction: row;
  font-size: .9rem; color: var(--text);
}
.modal-body label.check input { width: auto; }
.modal-body input,
.modal-body select,
.modal-body textarea { margin-top: .35rem; }
.modal-foot {
  display: flex; gap: .5rem; align-items: center;
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--border);
}
.modal-foot .danger-btn { color: var(--danger); border-color: var(--danger); }
.modal-error { padding: 0 1.25rem 1rem; }
