/* ── Leave Tracker — Frontend Styles ─────────────────────────────────────── */

.lt-app {
    --lt-bg:           #0d0f12;
    --lt-surface:      #141720;
    --lt-surface2:     #1c2030;
    --lt-border:       #252a3a;
    --lt-border2:      #2e3550;
    --lt-text:         #e8eaf0;
    --lt-text-dim:     #7a8099;
    --lt-text-muted:   #4a5068;
    --lt-green:        #22c97a;
    --lt-green-bg:     #0d2a1e;
    --lt-green-border: #174d33;
    --lt-amber:        #f59e0b;
    --lt-amber-bg:     #2a1e06;
    --lt-amber-border: #4d3508;
    --lt-red:          #ef4444;
    --lt-red-bg:       #2a0d0d;
    --lt-red-border:   #4d1515;
    --lt-blue:         #3b82f6;
    --lt-blue-bg:      #0d1a2a;
    --lt-blue-border:  #153050;
    --lt-accent:       #6366f1;
    --lt-font:         'Inter', sans-serif;
    --lt-mono:         'DM Mono', monospace;

    background: var(--lt-bg);
    color: var(--lt-text);
    font-family: var(--lt-font);
    font-size: 14px;
    line-height: 1.5;
    padding: 24px 20px 60px;
    border-radius: 12px;
}

/* ── Reset inside scope ────────────────────────────────────────────────── */
.lt-app *, .lt-app *::before, .lt-app *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
.lt-app table { border-collapse: collapse; }

/* ── Header ────────────────────────────────────────────────────────────── */
.lt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.lt-title {
    font-size: 20px !important;
    font-weight: 700 !important;
    letter-spacing: -.4px;
    color: var(--lt-text) !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
.lt-subtitle {
    font-size: 12px;
    color: var(--lt-text-dim);
    margin-top: 2px;
}
.lt-global-allowance {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--lt-surface);
    border: 1px solid var(--lt-border);
    border-radius: 10px;
    padding: 10px 14px;
}
.lt-global-allowance label {
    font-size: 12px;
    color: var(--lt-text-dim);
    white-space: nowrap;
}
.lt-global-allowance input {
    width: 56px;
    background: var(--lt-surface2);
    border: 1px solid var(--lt-border2);
    border-radius: 6px;
    padding: 5px 8px;
    color: var(--lt-text);
    font-family: var(--lt-mono);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    outline: none;
    transition: border-color .15s;
}
.lt-global-allowance input:focus { border-color: var(--lt-accent); }
.lt-global-allowance span { font-size: 12px; color: var(--lt-text-muted); }

/* ── Chat Bar ──────────────────────────────────────────────────────────── */
.lt-chat-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    background: var(--lt-surface);
    border: 1px solid var(--lt-border);
    border-radius: 12px;
    padding: 8px 8px 8px 14px;
    transition: border-color .15s;
}
.lt-chat-bar:focus-within { border-color: var(--lt-accent); }
.lt-chat-icon {
    color: var(--lt-accent);
    font-size: 16px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 2px;
}
.lt-chat-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--lt-text);
    font-family: var(--lt-font);
    font-size: 14px;
    min-width: 0;
}
.lt-chat-bar input::placeholder { color: var(--lt-text-muted); }
.lt-chat-send {
    background: var(--lt-accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    padding: 8px 16px;
    font-family: var(--lt-font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.lt-chat-send:hover { opacity: .85; }
.lt-chat-send:disabled { opacity: .4; cursor: default; }

/* ── AI Response ───────────────────────────────────────────────────────── */
.lt-ai-response {
    display: none;
    margin-bottom: 16px;
    background: var(--lt-surface);
    border: 1px solid var(--lt-border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--lt-text-dim);
}
.lt-ai-response.lt-visible  { display: block; }
.lt-ai-response.lt-error    { border-color: var(--lt-red-border); color: var(--lt-red); }
.lt-ai-response.lt-loading  { color: var(--lt-text-muted); }
.lt-ai-response strong      { color: var(--lt-text); }

/* ── Summary ───────────────────────────────────────────────────────────── */
.lt-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.lt-summary-card {
    background: var(--lt-surface);
    border: 1px solid var(--lt-border);
    border-radius: 10px;
    padding: 14px 16px;
}
.lt-sc-value {
    font-family: var(--lt-mono);
    font-size: 26px;
    font-weight: 500;
    line-height: 1;
}
.lt-sc-label {
    font-size: 11px;
    color: var(--lt-text-dim);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.lt-summary-card.lt-green .lt-sc-value { color: var(--lt-green); }
.lt-summary-card.lt-amber .lt-sc-value { color: var(--lt-amber); }
.lt-summary-card.lt-red   .lt-sc-value { color: var(--lt-red);   }

/* ── Actions bar ───────────────────────────────────────────────────────── */
.lt-actions-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}
.lt-btn-add {
    background: var(--lt-surface);
    border: 1px solid var(--lt-border);
    border-radius: 8px;
    color: var(--lt-text);
    font-family: var(--lt-font);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: border-color .15s, background .15s;
}
.lt-btn-add svg { color: var(--lt-accent); }
.lt-btn-add:hover { border-color: var(--lt-accent); background: var(--lt-surface2); }

/* ── Table ─────────────────────────────────────────────────────────────── */
.lt-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--lt-border);
}
.lt-table {
    width: 100%;
    min-width: 620px;
}
.lt-table thead th {
    background: var(--lt-surface);
    padding: 11px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--lt-text-dim);
    border-bottom: 1px solid var(--lt-border);
    text-align: left;
    white-space: nowrap;
}
.lt-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--lt-surface);
}
.lt-table tbody tr {
    border-bottom: 1px solid var(--lt-border);
    transition: background .1s;
}
.lt-table tbody tr:last-child { border-bottom: none; }
.lt-table tbody tr:hover { background: var(--lt-surface); }
.lt-table tbody td { padding: 12px 14px; vertical-align: middle; }
.lt-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--lt-bg);
    transition: background .1s;
}
.lt-table tbody tr:hover td:first-child { background: var(--lt-surface); }

.lt-td-name { font-weight: 600; font-size: 14px; }
.lt-td-num  { font-family: var(--lt-mono); font-size: 14px; font-weight: 500; }
.lt-td-num.lt-over { color: var(--lt-red); }

.lt-allowance-input {
    width: 60px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--lt-text);
    font-family: var(--lt-mono);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    outline: none;
    transition: border-color .15s, background .15s;
    cursor: pointer;
}
.lt-allowance-input:hover,
.lt-allowance-input:focus {
    border-color: var(--lt-border2);
    background: var(--lt-surface2);
}

.lt-loading {
    text-align: center;
    padding: 40px;
    color: var(--lt-text-muted);
    font-size: 13px;
}

/* ── Progress Bar ──────────────────────────────────────────────────────── */
.lt-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}
.lt-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--lt-surface2);
    border-radius: 99px;
    overflow: hidden;
}
.lt-progress-fill {
    height: 100%;
    border-radius: 99px;
    transition: width .3s;
}
.lt-progress-fill.lt-green { background: var(--lt-green); }
.lt-progress-fill.lt-amber { background: var(--lt-amber); }
.lt-progress-fill.lt-red   { background: var(--lt-red);   }
.lt-progress-fill.lt-blue  { background: var(--lt-blue);  }
.lt-progress-pct {
    font-family: var(--lt-mono);
    font-size: 12px;
    color: var(--lt-text-dim);
    width: 36px;
    text-align: right;
    flex-shrink: 0;
}

/* ── Badge ─────────────────────────────────────────────────────────────── */
.lt-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    padding: 3px 9px;
    border-radius: 99px;
    white-space: nowrap;
}
.lt-badge.lt-green { background: var(--lt-green-bg); color: var(--lt-green); border: 1px solid var(--lt-green-border); }
.lt-badge.lt-amber { background: var(--lt-amber-bg); color: var(--lt-amber); border: 1px solid var(--lt-amber-border); }
.lt-badge.lt-red   { background: var(--lt-red-bg);   color: var(--lt-red);   border: 1px solid var(--lt-red-border);   }
.lt-badge.lt-blue  { background: var(--lt-blue-bg);  color: var(--lt-blue);  border: 1px solid var(--lt-blue-border);  }

/* ── Row Actions ───────────────────────────────────────────────────────── */
.lt-td-actions { display: flex; align-items: center; gap: 6px; }
.lt-btn-history,
.lt-btn-remove {
    background: none;
    border: 1px solid var(--lt-border);
    border-radius: 7px;
    font-size: 12px;
    padding: 4px 9px;
    cursor: pointer;
    font-family: var(--lt-font);
    transition: border-color .15s, background .15s, color .15s;
    white-space: nowrap;
}
.lt-btn-history { color: var(--lt-text-dim); }
.lt-btn-history:hover { border-color: var(--lt-accent); color: var(--lt-accent); background: #1a1d30; }
.lt-btn-remove  { color: var(--lt-text-muted); }
.lt-btn-remove:hover { border-color: var(--lt-red-border); color: var(--lt-red); background: var(--lt-red-bg); }

/* ── History Panel ─────────────────────────────────────────────────────── */
.lt-history-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
}
.lt-history-overlay.lt-open {
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
@media (min-width: 600px) {
    .lt-history-overlay.lt-open { align-items: center; }
}
.lt-history-panel {
    background: var(--lt-surface);
    border: 1px solid var(--lt-border2);
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: lt-slide-up .2s ease;
}
@media (min-width: 600px) { .lt-history-panel { border-radius: 16px; } }
@keyframes lt-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
.lt-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--lt-border);
}
.lt-history-header h3 {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--lt-text) !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
.lt-history-header span {
    font-size: 12px;
    color: var(--lt-text-dim);
    margin-top: 2px;
    display: block;
}
.lt-btn-close {
    background: var(--lt-surface2);
    border: 1px solid var(--lt-border);
    border-radius: 8px;
    color: var(--lt-text-dim);
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: border-color .15s;
    flex-shrink: 0;
}
.lt-btn-close:hover { border-color: var(--lt-border2); color: var(--lt-text); }
.lt-history-list { overflow-y: auto; flex: 1; padding: 8px 0; }
.lt-history-empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--lt-text-muted);
    font-size: 13px;
}
.lt-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid var(--lt-border);
    gap: 12px;
}
.lt-history-item:last-child { border-bottom: none; }
.lt-history-date {
    font-family: var(--lt-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--lt-text);
}
.lt-history-rel { font-size: 11px; color: var(--lt-text-muted); margin-top: 1px; }
.lt-btn-delete-date {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--lt-text-muted);
    font-size: 12px;
    padding: 3px 8px;
    cursor: pointer;
    transition: all .15s;
    font-family: var(--lt-font);
    flex-shrink: 0;
}
.lt-btn-delete-date:hover { border-color: var(--lt-red-border); color: var(--lt-red); background: var(--lt-red-bg); }

/* ── Spinner ───────────────────────────────────────────────────────────── */
.lt-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--lt-border2);
    border-top-color: var(--lt-accent);
    border-radius: 50%;
    animation: lt-spin .6s linear infinite;
    vertical-align: middle;
}
@keyframes lt-spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
.lt-app ::-webkit-scrollbar { width: 6px; height: 6px; }
.lt-app ::-webkit-scrollbar-track { background: transparent; }
.lt-app ::-webkit-scrollbar-thumb { background: var(--lt-border2); border-radius: 99px; }
