/* ─── Tokens ─────────────────────────────────────────────────────────────────── */
:root {
    --tt-dark:        #1a1918;
    --tt-dark-soft:   #2c2a28;
    --tt-green:       #4a7a2b;
    --tt-green-dark:  #375e20;
    --tt-green-light: #edf5e6;
    --tt-green-mid:   #a8c894;
    --tt-body-bg:     #ffffff;
    --tt-gray:        #f4f4f0;
    --tt-border:      #e2e1db;
    --tt-border-light:#eeede8;
    --tt-surface:     #ffffff;
    --radius:         2px;
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:      0 4px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
    --shadow-lg:      0 8px 28px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
    --transition:     0.13s ease;
}

/* ─── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Base ───────────────────────────────────────────────────────────────────── */
html { font-size: 16px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--tt-dark);
    background-color: var(--tt-body-bg);
    -webkit-font-smoothing: antialiased;
}

/* Auth layout uses bg-light for the page wrapper */
body.bg-light { background-color: var(--tt-gray); }

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.4px;
}

a { color: var(--tt-green); text-decoration: none; }
a:hover { color: var(--tt-green-dark); text-decoration: underline; }

img { max-width: 100%; height: auto; }
ul  { list-style: none; }

/* ─── Container ──────────────────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ─── Grid ───────────────────────────────────────────────────────────────────── */
.row { display: flex; flex-wrap: wrap; }
.g-3 { gap: 1rem;    }
.g-4 { gap: 1.5rem;  }

[class*="col-"] { flex: 0 0 100%; max-width: 100%; min-width: 0; }
.col-6  { flex: 0 0 50%;  max-width: 50%;  }
.col-12 { flex: 0 0 100%; max-width: 100%; }

@media (min-width: 576px) {
    .col-sm-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-sm-8 { flex: 0 0 66.667%; max-width: 66.667%; }
    .d-sm-inline { display: inline !important; }
}

@media (min-width: 768px) {
    .col-md-1 { flex: 0 0 8.333%;  max-width: 8.333%;  }
    .col-md-3 { flex: 0 0 25%;     max-width: 25%;      }
    .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%;  }
    .col-md-5 { flex: 0 0 41.667%; max-width: 41.667%;  }
    .col-md-6 { flex: 0 0 50%;     max-width: 50%;      }
    .col-md-7 { flex: 0 0 58.333%; max-width: 58.333%;  }
    .col-md-9 { flex: 0 0 75%;     max-width: 75%;      }
    .d-md-block  { display: block  !important; }
    .d-md-none   { display: none   !important; }
    .d-md-inline { display: inline !important; }
    .d-md-flex   { display: flex   !important; }
}

@media (min-width: 992px) {
    .col-lg-3 { flex: 0 0 25%;     max-width: 25%;      }
    .col-lg-5 { flex: 0 0 41.667%; max-width: 41.667%;  }
    .col-lg-6 { flex: 0 0 50%;     max-width: 50%;      }
    .col-lg-7 { flex: 0 0 58.333%; max-width: 58.333%;  }
    .col-lg-9 { flex: 0 0 75%;     max-width: 75%;      }
}

.justify-content-center  { justify-content: center;        }
.justify-content-end     { justify-content: flex-end;      }

/* ─── Flex utilities ─────────────────────────────────────────────────────────── */
.d-flex   { display: flex;   }
.d-block  { display: block;  }
.d-none   { display: none;   }
.d-inline { display: inline; }

.flex-column   { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap;        }
.flex-grow-1   { flex-grow: 1;           }
.flex-shrink-0 { flex-shrink: 0;         }

.align-items-center      { align-items: center;         }
.align-items-start       { align-items: flex-start;     }
.justify-content-between { justify-content: space-between; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem;  }
.gap-3 { gap: 1rem;    }
.gap-4 { gap: 1.5rem;  }

.ms-auto { margin-left: auto !important; }

/* ─── Spacing ────────────────────────────────────────────────────────────────── */
.mb-0 { margin-bottom: 0;       }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem;  }
.mb-3 { margin-bottom: 1rem;    }
.mb-4 { margin-bottom: 1.5rem;  }
.mb-5 { margin-bottom: 3rem;    }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem;  }
.mt-3 { margin-top: 1rem;    }
.mt-4 { margin-top: 1.5rem;  }
.mt-5 { margin-top: 3rem;    }

.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem;  }
.ms-1 { margin-left: 0.25rem;  }
.ms-2 { margin-left: 0.5rem;   }

.p-0 { padding: 0;       }
.p-2 { padding: 0.5rem;  }
.p-3 { padding: 1rem;    }
.p-4 { padding: 1.5rem;  }

.px-3 { padding-left: 1rem;   padding-right: 1rem;   }
.px-4 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-5 { padding-left: 3rem;   padding-right: 3rem;   }

.py-2 { padding-top: 0.5rem;  padding-bottom: 0.5rem;  }
.py-3 { padding-top: 1rem;    padding-bottom: 1rem;    }
.py-4 { padding-top: 1.5rem;  padding-bottom: 1.5rem;  }
.py-5 { padding-top: 3rem;    padding-bottom: 3rem;    }

.pt-3 { padding-top: 1rem;  }
.ps-3 { padding-left: 1rem; }

/* ─── Typography ─────────────────────────────────────────────────────────────── */
.fw-bold    { font-weight: 700; }
.fw-semibold{ font-weight: 600; }
.fw-medium  { font-weight: 500; }
.fw-normal  { font-weight: 400; }

.text-muted  { color: #888;           }
.text-white  { color: #fff;           }
.text-dark   { color: var(--tt-dark); }
.text-danger { color: #c0392b;        }
.text-success{ color: var(--tt-green);}

.text-center          { text-align: center;    }
.text-end             { text-align: right;     }
.text-decoration-none { text-decoration: none; }
.text-nowrap          { white-space: nowrap;   }

.small    { font-size: 0.875rem; }
.lead     { font-size: 1.15rem; line-height: 1.75; }
.display-5 {
    font-size: clamp(2.2rem, 5.5vw, 3.6rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -1px;
}
.fs-4           { font-size: 1.5rem;  }
.fs-5           { font-size: 1.25rem; }
.font-monospace { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }

/* ─── Sizing ─────────────────────────────────────────────────────────────────── */
.w-100       { width: 100%;       }
.h-100       { height: 100%;      }
.min-vh-100  { min-height: 100vh; }
.overflow-hidden { overflow: hidden; }

/* ─── Backgrounds / borders ──────────────────────────────────────────────────── */
.bg-white   { background-color: #fff;              }
.bg-light   { background-color: var(--tt-gray);    }
.border-top    { border-top: 1px solid var(--tt-border); }
.border-bottom { border-bottom: 1px solid var(--tt-border); }
.border-0      { border: none;                      }
.border-danger { border-color: #c0392b !important;  }
.rounded-0     { border-radius: 0;                  }

/* ─── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    height: 58px;
    background-color: var(--tt-surface);
    border-bottom: 1px solid var(--tt-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.navbar-brand { display: flex; align-items: center; padding: 0; text-decoration: none; }
.navbar-brand:hover { text-decoration: none; }
.navbar-brand img.tt-logo { height: 34px; width: auto; display: block; }

/* ─── Dropdown via <details> ─────────────────────────────────────────────────── */
details.dropdown { position: relative; display: inline-block; }

details.dropdown > summary { list-style: none; cursor: pointer; }
details.dropdown > summary::-webkit-details-marker { display: none; }
details.dropdown > summary::marker { display: none; }

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 200;
    min-width: 195px;
    background: var(--tt-surface);
    border: 1px solid var(--tt-border);
    border-radius: var(--radius);
    padding: 4px 0;
    box-shadow: var(--shadow-lg);
}

details.dropdown[open] > .dropdown-menu { display: block; }
.dropdown-menu li { display: block; }

.dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    font-size: 0.875rem;
    color: var(--tt-dark);
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    line-height: 1.4;
    transition: background-color var(--transition);
}
.dropdown-item:hover { background-color: var(--tt-gray); color: var(--tt-dark); text-decoration: none; }
hr.dropdown-divider { border: none; border-top: 1px solid var(--tt-border-light); margin: 4px 0; }

/* ─── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.5rem 1.2rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 0.1px;
    white-space: nowrap;
    transition: background-color var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
    appearance: none;
    -webkit-appearance: none;
}
.btn:hover { text-decoration: none; }

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem;  }
.btn-lg { padding: 0.7rem 1.8rem;  font-size: 0.95rem; font-weight: 700; letter-spacing: 0.2px; }

.btn-dark {
    background-color: var(--tt-dark);
    border-color: var(--tt-dark);
    color: #fff;
}
.btn-dark:hover {
    background-color: var(--tt-dark-soft);
    border-color: var(--tt-dark-soft);
    color: #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    transform: translateY(-1px);
}

.btn-brand {
    background-color: var(--tt-green);
    border-color: var(--tt-green);
    color: #fff;
}
.btn-brand:hover {
    background-color: var(--tt-green-dark);
    border-color: var(--tt-green-dark);
    color: #fff;
    box-shadow: 0 3px 10px rgba(74,122,43,0.4);
    transform: translateY(-1px);
}

.btn-warning { background-color: var(--tt-green); border-color: var(--tt-green); color: #fff; }
.btn-warning:hover { background-color: var(--tt-green-dark); border-color: var(--tt-green-dark); color: #fff; }

.btn-outline-secondary {
    background: transparent;
    border-color: var(--tt-border);
    color: #555;
}
.btn-outline-secondary:hover {
    background-color: var(--tt-dark);
    border-color: var(--tt-dark);
    color: #fff;
}

.btn-outline-brand {
    background: transparent;
    border-color: var(--tt-green);
    color: var(--tt-green);
}
.btn-outline-brand:hover {
    background-color: var(--tt-green);
    border-color: var(--tt-green);
    color: #fff;
}

.btn-outline-light {
    background: transparent;
    border-color: rgba(255,255,255,0.35);
    color: rgba(255,255,255,0.8);
}
.btn-outline-light:hover {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.65);
    color: #fff;
}

.btn-outline-warning {
    background: transparent;
    border-color: var(--tt-green);
    color: var(--tt-green);
}
.btn-outline-warning:hover { background-color: var(--tt-green); border-color: var(--tt-green); color: #fff; }

.btn-outline-danger  { background: transparent; border-color: #c0392b; color: #c0392b; }
.btn-outline-danger:hover { background-color: #c0392b; border-color: #c0392b; color: #fff; }

.btn-danger { background-color: #c0392b; border-color: #c0392b; color: #fff; }
.btn-danger:hover { background-color: #a93226; border-color: #a93226; color: #fff; }

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.form-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #3a3a36;
}

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 0.52rem 0.85rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--tt-dark);
    background-color: var(--tt-surface);
    border: 1px solid #d0cfca;
    border-radius: var(--radius);
    appearance: none;
    -webkit-appearance: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23999' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 11px;
    padding-right: 2.25rem;
    cursor: pointer;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--tt-green);
    box-shadow: 0 0 0 3px rgba(74, 122, 43, 0.12);
}

.form-control-sm { padding: 0.3rem 0.65rem; font-size: 0.85rem; }

.form-text { display: block; margin-top: 0.3rem; font-size: 0.8rem; color: #aaa; }

.form-check { display: flex; align-items: flex-start; gap: 0.5rem; margin-bottom: 0; }

.form-check-input {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 3px;
    border: 1.5px solid #ccc;
    border-radius: var(--radius);
    background-color: var(--tt-surface);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: background-color var(--transition), border-color var(--transition);
}

.form-check-input:checked {
    background-color: var(--tt-green);
    border-color: var(--tt-green);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 11px;
}

.form-check-label { font-size: 0.875rem; line-height: 1.5; cursor: pointer; }

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
    background-color: var(--tt-surface);
    border: 1px solid var(--tt-border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.card-body   { padding: 1.25rem; flex: 1 1 auto; }
.card-header { padding: 0.75rem 1.25rem; background-color: #f8f8f4; border-bottom: 1px solid var(--tt-border); }

.card.border-0        { border: 1px solid var(--tt-border); }
.card.shadow-sm       { box-shadow: var(--shadow-sm); }
.card.border-danger   { border-color: #e8c8c4; }

/* ─── Application status cards (dashboard) ───────────────────────────────────── */
.app-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--tt-surface);
    border: 1px solid var(--tt-border);
    border-left: 3px solid var(--tt-border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--tt-dark);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
    overflow: hidden;
}

.app-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--tt-dark);
    text-decoration: none;
}

.app-card.accent-green   { border-left-color: var(--tt-green); }
.app-card.accent-amber   { border-left-color: #c9962a;         }
.app-card.accent-red     { border-left-color: #c0392b;         }
.app-card.accent-neutral { border-left-color: #ccc;            }

.app-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 18px 13px;
    border-bottom: 1px solid var(--tt-border-light);
}

.app-card__label { font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.app-card__type  { font-size: 0.77rem; color: #aaa; margin-top: 2px; }

.app-card__body  { padding: 14px 18px; flex: 1; }

.app-card__code {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 7px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.app-card__message     { font-size: 0.875rem; color: #333; line-height: 1.5; }
.app-card__instruction { font-size: 0.82rem; color: #999; margin-top: 5px; line-height: 1.4; }
.app-card__pending     { font-size: 0.875rem; color: #bbb; }

.app-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    border-top: 1px solid var(--tt-border-light);
    background-color: #fafaf8;
}

.app-card__checked { font-size: 0.72rem; color: #bbb; }
.app-card__cta     { font-size: 0.78rem; font-weight: 600; color: var(--tt-green); }

/* ─── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
    padding: 0.8rem 1rem;
    border: 1px solid transparent;
    border-left-width: 3px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.alert-success { background-color: #f0f7ea; border-color: var(--tt-green-mid); border-left-color: var(--tt-green); color: #2a4a18; }
.alert-danger  { background-color: #fdf0ee; border-color: #e8b4ae; border-left-color: #c0392b; color: #6b1010; }
.alert-warning { background-color: #fdf8ec; border-color: #d4a843; border-left-color: #c09030; color: #4a3a10; }

/* ─── Badge ──────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.55em;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: var(--radius);
    color: #fff;
    background-color: #888;
    white-space: nowrap;
    line-height: 1;
}

.bg-success  { background-color: var(--tt-green) !important; }
.bg-secondary{ background-color: #8a8a84        !important; }
.bg-danger   { background-color: #c0392b         !important; }
.bg-warning  { background-color: #c9962a         !important; }

/* ─── Table ──────────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

.table th,
.table td {
    padding: 0.65rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid var(--tt-border-light);
    vertical-align: top;
}

.table thead th,
.table-light th {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #999;
    background-color: #f8f8f4;
    border-bottom: 1px solid var(--tt-border);
}

.table-hover tbody tr:hover { background-color: #fafaf7; }
.table.mb-0 { margin-bottom: 0; }

/* ─── Auth layout ────────────────────────────────────────────────────────────── */
.auth-logo { height: 50px; width: auto; }
.tt-logo   { height: 34px; width: auto; display: block; }

/* ─── Landing sections ───────────────────────────────────────────────────────── */
.hero-dark { background-color: var(--tt-dark); }

.text-brand     { color: var(--tt-green); }
.text-brand-muted { color: var(--tt-green-mid); }
.bg-brand       { background-color: var(--tt-green); }
.border-brand   { border-color: var(--tt-green) !important; }

/* ─── Landing: value strip inline items ──────────────────────────────────────── */
.value-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem 3rem;
}

.value-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.value-item .bi { font-size: 1rem; }
.value-item .bi-whatsapp    { color: #25d366; }
.value-item .bi-envelope    { color: var(--tt-green); }
.value-item .bi-clock-history { color: #888; }
.value-item .bi-shield-check  { color: var(--tt-green); }

/* ─── Landing: step numbers ──────────────────────────────────────────────────── */
.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background-color: var(--tt-dark);
    color: var(--tt-green);
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -1px;
}

/* ─── <details> collapse ─────────────────────────────────────────────────────── */
details > summary { cursor: pointer; list-style: none; display: inline; }
details > summary::-webkit-details-marker { display: none; }
details > summary::marker { display: none; }
