/* DigitalRegister theme
   One calm neutral palette with a single accent (teal).  Red / amber / green are reserved for meaning:
   overdue, due soon, paid.  Everything below reads these variables, so recolouring is a one place change.
-------------------------------------------------- */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --line: #e5e7eb;
  --text: #111827;
  --muted: #4b5563;

  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #e6f4f2;

  --danger: #dc2626;
  --danger-tint: #fef6f5;
  --warn: #d97706;
  --warn-tint: #fffaf0;
  --good: #15803d;
  --good-tint: #effaf2;
  --credit-tint: #f1f3f5;

  --radius: 12px;
}

html {
  font-size: 15px;
  position: relative;
  min-height: 100%;
}
@media (min-width: 768px) {
  html { font-size: 16px; }
}

body {
  margin-bottom: 60px;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.4rem; }
.text-muted { color: var(--muted) !important; }

/* Navigation
-------------------------------------------------- */
.app-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
  padding-top: .6rem;
  padding-bottom: .6rem;
}
.app-nav .navbar-brand {
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.app-nav .nav-link {
  color: var(--muted);
  font-weight: 500;
  border-radius: 8px;
  padding: .4rem .75rem;
  margin-right: .15rem;
}
.app-nav .nav-link:hover { color: var(--text); background: var(--bg); }
.app-nav .nav-link.active { color: var(--accent); background: var(--accent-soft); }
.app-nav .navbar-toggler { border-color: var(--line); }

.app-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
  color: var(--muted);
  font-size: .85rem;
}

/* Page structure
-------------------------------------------------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.page-head h1 { margin: 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  overflow: hidden;
  margin-bottom: 4rem;
}

/* Buttons and forms
-------------------------------------------------- */
.btn {
  border-radius: 8px;
  font-weight: 500;
}
.btn-primary {
  color: #fff;
  background-color: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-primary:not(:disabled):not(.disabled):active {
  color: #fff;
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-outline-primary { color: var(--accent); border-color: var(--accent); }
.btn-outline-primary:hover { color: #fff; background-color: var(--accent); border-color: var(--accent); }
.btn-light { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-light:hover { background: var(--bg); border-color: var(--line); }
.btn-danger { background-color: var(--danger); border-color: var(--danger); }
.btn:focus, .btn.focus, .form-control:focus {
  box-shadow: 0 0 0 .2rem rgba(15, 118, 110, .22);
}

.form-control {
  border-radius: 8px;
  border-color: #d1d5db;
}
.form-control:focus { border-color: var(--accent); }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
  color: #fff;
  background-color: var(--accent);
}

.modal-content {
  border: 0;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(16, 24, 40, .25);
}
.modal-header { border-bottom: 0; padding-bottom: .25rem; }
.modal-title { font-size: 1.2rem; }
.modal-body { padding-top: .75rem; }

.alert { border-radius: 8px; }
.badge { font-weight: 600; padding: .35em .6em; border-radius: 999px; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-secondary { background: #f3f4f6; color: #374151; }
.badge-info { background: #e0f2fe; color: #075985; }

/* Tables (every list in the app)
-------------------------------------------------- */
.table {
  background: var(--surface);
  color: var(--text);
  margin-bottom: 1.5rem;
}
.table th {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  background: #fafafb;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  padding: .75rem;
}
.table td { border-top: 1px solid var(--line); padding: .75rem; vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr:hover { background: #fafafb; }

/* Transaction register
-------------------------------------------------- */
.register { margin: 0; }
.register td { font-size: 1rem; padding: .9rem .75rem; }
.register th:first-child, .register td:first-child { padding-left: 1.25rem; }
.register th:last-child, .register td:last-child { padding-right: 1.25rem; }

.register .c-date, .register .c-amount, .register .c-total, .register .c-status {
  white-space: nowrap;
}
.register .c-date { color: var(--muted); }
.register .c-merchant { font-weight: 600; }
.register .c-desc { color: var(--muted); }
.register .c-amount, .register .c-total, .register th.text-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.register .c-amount.credit { color: var(--good); }
.register .c-total { font-weight: 600; }
.register .c-total.neg { color: var(--danger); }
.register-warning { height: 16px; margin: 0 0 3px 8px; }

/* The actions column shrinks to its links */
.register .c-actions { width: 1%; white-space: nowrap; text-align: right; }
.register .row-actions { display: inline-flex; align-items: center; gap: .9rem; }
.register .row-actions a { text-decoration: none; font-weight: 500; }
.register .row-actions a:hover { text-decoration: underline; }
.register .row-actions .act-next {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: .15rem .75rem;
  font-size: .9rem;
}
.register .row-actions .act-next:hover { background: var(--accent-soft); text-decoration: none; }

/* What needs attention: a coloured edge and a faint tint; settled rows stay quiet */
.register tr.tone-overdue { background: var(--danger-tint); }
.register tr.tone-overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.register tr.tone-due { background: var(--warn-tint); }
.register tr.tone-due td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.register tr.tone-paid { background: var(--good-tint); }
.register tr.tone-paid td:first-child { box-shadow: inset 3px 0 0 var(--good); }
.register tr.tone-credit { background: var(--credit-tint); }
.register tr.tone-credit td:first-child { box-shadow: inset 3px 0 0 #64748b; }
.register .c-amount.credit { font-weight: 600; }

/* Forecast: bills the app expects but you haven't entered */
.register tr.row-forecast td { color: var(--muted); }
.register tr.row-forecast .c-desc { font-style: italic; }
.register tr.row-forecast .pill { background: transparent; border: 1px dashed #c4c8cf; }

.register .register-more td { text-align: center; padding: .6rem; background: #fafafb; font-size: .9rem; }

/* Status pills (also used on the merchant page) */
.pill {
  display: inline-block;
  padding: .15rem .65rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  background: #f3f4f6;
  color: #4b5563;
}
.pill-scheduled { background: #e0ecff; color: #1d4ed8; }
.pill-paid { background: #dcfce7; color: #166534; }
.pill-autopay { background: #ccfbf1; color: #115e59; }
.pill-adjustment { background: #ede9fe; color: #5b21b6; }
.pill-complete { background: transparent; color: var(--muted); border: 1px solid var(--line); }

.tone-overdue { background: var(--danger-tint); }
.tone-due { background: var(--warn-tint); }
.tone-paid { background: var(--good-tint); }
.tone-credit { background: var(--credit-tint); }

/* Phones: each transaction becomes a small card instead of a seven column row */
@media (max-width: 767.98px) {
  .page-head h1 { font-size: 1.4rem; }
  .panel { border-radius: 10px; }
  .register thead { display: none; }
  .register, .register tbody { display: block; }
  .register tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "merchant amount"
      "desc desc"
      "date total"
      "status status"
      "actions actions";
    align-items: center;
    row-gap: .15rem;
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--line);
  }
  .register tbody tr:last-child { border-bottom: 0; }
  .register td, .register td:first-child, .register td:last-child {
    display: block;
    border: 0;
    padding: .1rem 0;
    box-shadow: none;
  }
  .register tr[class*="tone-"] td:first-child { box-shadow: none; }
  .register tr.tone-overdue { box-shadow: inset 3px 0 0 var(--danger); }
  .register tr.tone-due { box-shadow: inset 3px 0 0 var(--warn); }
  .register tr.tone-paid { box-shadow: inset 3px 0 0 var(--good); }
  .register tr.tone-credit { box-shadow: inset 3px 0 0 #64748b; }
  .register .c-merchant { grid-area: merchant; }
  .register .c-amount { grid-area: amount; font-weight: 600; }
  .register .c-desc { grid-area: desc; word-break: break-word; }
  .register .c-desc:empty { display: none; }
  .register .c-date { grid-area: date; font-size: .9rem; }
  .register .c-total { grid-area: total; font-size: .9rem; }
  .register .c-total::before { content: "Balance "; color: var(--muted); font-weight: 400; }
  .register .c-status { grid-area: status; justify-self: start; padding-top: .45rem; }
  .register .c-actions { grid-area: actions; width: auto; text-align: left; padding-top: .6rem; }

  /* Links become tap-sized buttons */
  .register .row-actions { gap: .5rem; }
  .register .row-actions a {
    padding: .5rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }
  .register .row-actions .act-next { border-color: var(--accent); border-radius: 8px; font-size: 1rem; }
  .register .register-more { display: block; text-align: center; padding: .6rem; background: #fafafb; }
  .register .register-more td { display: block; }
}

/* Misc
-------------------------------------------------- */
button.accept-policy {
  font-size: 1rem;
  line-height: inherit;
}

/* Lock Icon
-------------------------------------------------- */

.lock {
  background: gray;
  border-radius: 0.1875rem;
  width: 1.5625rem;
  height: 1.25rem;
  margin-top: 1rem;
  margin-left: 1rem;
  position: relative;
}

.lock:before {
  content: "";
  display: block;
  position: absolute;
  border:0.1875rem solid gray;
  top: -0.875rem;
  left: 0.14375rem;
  width: 1.25rem;
  height: 1.6875rem;
  border-radius: 2.1875rem 2.1875rem 0 0;
}
