* { box-sizing: border-box; }
body {
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    margin: 0; background: #14161c; color: #eaeaea;
}

/* ---- Login page (kept light-neutral, it's a one-time screen) ---- */
.login-page { display: flex; align-items: center; justify-content: center; height: 100vh; background: #14161c; }
.login-box { background: #1e2129; padding: 32px 28px; border-radius: 12px; box-shadow: 0 2px 20px rgba(0,0,0,0.5); width: 90%; max-width: 360px; }
.login-box h1 { font-size: 20px; margin-bottom: 20px; text-align: center; color: #fff; }
.login-box label { display: block; margin: 12px 0 4px; font-size: 13px; color: #9aa0ab; }
.login-box input[type=text], .login-box input[type=password] { width: 100%; padding: 10px; border: 1px solid #30343e; border-radius: 8px; font-size: 16px; background: #14161c; color: #fff; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 14px; color: #9aa0ab; }
.login-box button { width: 100%; margin-top: 18px; padding: 12px; background: #2ecc71; color: #0c0c0c; border: none; border-radius: 8px; font-size: 16px; font-weight: 700; }
.error { color: #ff5c5c; font-size: 13px; }

/* ---- Top bar ---- */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px; background: #1a1d24; border-bottom: 1px solid #262a33; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
.topnav { display: flex; align-items: center; gap: 16px; }
.topnav a { color: #9aa0ab; text-decoration: none; font-size: 13px; }
.topnav a:hover { color: #fff; }

/* ---- Top-right "more" dropdown menu (feature pages that don't need a permanent nav slot) ---- */
.menu-wrap { position: relative; }
.menu-btn { background: none; border: none; color: #9aa0ab; font-size: 18px; line-height: 1; padding: 2px 6px; cursor: pointer; border-radius: 6px; }
.menu-btn:hover { color: #fff; background: #232630; }
.dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + 8px); background: #1e2129; border: 1px solid #30343e; border-radius: 8px; min-width: 160px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 30; overflow: hidden; }
.dropdown-menu.open { display: block; }
.dropdown-menu a { display: block; padding: 10px 14px; color: #c7ccd6; text-decoration: none; font-size: 13px; }
.dropdown-menu a:hover { background: #262a33; color: #fff; }
.dropdown-menu a.menu-divider { border-top: 1px solid #262a33; margin-top: 4px; padding-top: 10px; }

/* ---- Market index strip (Sensex/Nifty) ---- */
.index-strip { display: flex; gap: 10px; padding: 10px 16px 0; max-width: 720px; margin: 0 auto; overflow-x: auto; }
.index-chip { flex: 1; min-width: 140px; background: #1e2129; border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; border: 1px solid #262a33; }
.index-name { font-size: 10px; color: #9aa0ab; text-transform: uppercase; letter-spacing: 0.03em; }
.index-value { font-size: 15px; font-weight: 700; color: #fff; }
.index-chip .price-change { font-size: 11px; margin-top: 0; }

/* ---- Portfolio / watchlist switcher pills ---- */
.pill-row { display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto; }
.pill { flex-shrink: 0; padding: 8px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; background: #232630; color: #c7ccd6; border: 1px solid #30343e; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pill.active { background: #21301f; color: #4ade80; border-color: #2ecc71; }
.pill.create-pill { background: transparent; border-style: dashed; color: #9aa0ab; cursor: pointer; }

/* ---- Summary cards ---- */
.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 4px 16px 12px; }
.card { background: #1e2129; border-radius: 10px; padding: 14px; border: 1px solid #262a33; min-width: 0; }
.card-label { font-size: 11px; color: #9aa0ab; text-transform: uppercase; letter-spacing: 0.03em; }
.card-value { font-size: 17px; font-weight: 700; margin-top: 4px; color: #fff; overflow-wrap: break-word; }
.card.gain-card { border-left: 3px solid #2ecc71; }
.card.loss-card { border-left: 3px solid #ff5c5c; }
.card.gain-card .card-value { color: #4ade80; }
.card.loss-card .card-value { color: #ff6b6b; }

.last-updated { text-align: center; font-size: 11px; color: #6b7280; margin: 0 0 8px; }
.hint { color: #6b7280; font-size: 12px; font-style: italic; }

.section-title { font-size: 13px; font-weight: 700; color: #9aa0ab; text-transform: uppercase; letter-spacing: 0.04em; margin: 18px 16px 8px; }

/* ---- Compact summary-by-type table (kept as a real table - it's dense numeric data, not rows to tap) ---- */
.summary-by-type table { border-collapse: collapse; margin: 0 16px; width: auto; min-width: 320px; max-width: 480px; background: #1e2129; border-radius: 10px; overflow: hidden; }
.summary-by-type th, .summary-by-type td { padding: 10px 12px; text-align: left; font-size: 13px; border-bottom: 1px solid #262a33; }
.summary-by-type th { color: #9aa0ab; font-weight: 600; font-size: 11px; text-transform: uppercase; }
.summary-by-type .total-row { background: #232630; font-weight: 700; }

/* ---- Action bar ---- */
.action-bar { display: flex; justify-content: flex-end; padding: 4px 16px 4px; }
.primary-btn { background: #2ecc71; color: #0c0c0c; border: none; padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; }

/* ---- Filter bar (Property Auctions) ---- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; background: #1e2129; border: 1px solid #262a33; border-radius: 10px; padding: 14px 16px; margin: 4px 16px 12px; }
.filter-field { display: flex; flex-direction: column; gap: 4px; }
.filter-field label { font-size: 11px; color: #9aa0ab; text-transform: uppercase; letter-spacing: 0.03em; }
.filter-field select, .filter-field input { font-family: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid #30343e; border-radius: 8px; background: #14161c; color: #eaeaea; min-width: 130px; }
.filter-field-wide input { min-width: 200px; }
.filter-actions { display: flex; align-items: center; gap: 12px; }
.filter-actions a { color: #9aa0ab; font-size: 13px; text-decoration: underline; }

/* ---- Warning banner (low-confidence parse, etc.) - reuses the loss-red left-border language ---- */
.warning-banner { border-left: 3px solid #ff5c5c; background: #1e2129; border-radius: 0 8px 8px 0; padding: 10px 14px; margin: 4px 16px 16px; font-size: 13px; color: #c7ccd6; }

/* ---- Content width cap: on large screens, center a comfortable reading
   width instead of stretching cards/tables edge-to-edge across the monitor.
   Mobile is unaffected since these are all well under typical phone widths. ---- */
.pill-row, .summary-cards, .summary-by-type, .section-title, .stock-list, .bottom-bar, .action-bar, .hint, .last-updated, .filter-bar, .warning-banner {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}
.summary-by-type table { margin-left: 0; margin-right: 0; } /* already sized to content, don't double-constrain */

/* ---- Compact card-list rows (the main "concise" layout) ---- */
.stock-list { padding: 0 16px 12px; }
.stock-row {
    display: flex; justify-content: space-between; align-items: center;
    background: #1e2129; border-radius: 10px; padding: 12px 12px 12px 0;
    margin-bottom: 6px; border-left: 4px solid #4b4f58; cursor: pointer;
}
.stock-row.row-gain { border-left-color: #2ecc71; }
.stock-row.row-loss { border-left-color: #ff5c5c; }
.stock-row-left { padding-left: 12px; }
.stock-name { font-size: 15px; font-weight: 700; color: #fff; }
.exch-badge { font-size: 10px; color: #6b7280; font-weight: 500; margin-left: 4px; }
.stock-sub { font-size: 12px; color: #9aa0ab; margin-top: 3px; }
.stock-row-right { text-align: right; padding-right: 6px; }
.price-main { font-size: 15px; font-weight: 700; color: #fff; }
.price-change { font-size: 12px; font-weight: 600; margin-top: 3px; }
.price-change.row-gain-text { color: #4ade80; }
.price-change.row-loss-text { color: #ff6b6b; }
.price-change.row-flat-text { color: #6b7280; }
.stock-total-row { background: #232630; font-weight: 700; }
.stock-total-row .stock-name { color: #c7ccd6; font-size: 13px; }

/* ---- Modal ---- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-overlay.open { display: flex; }
body.modal-open { overflow: hidden; }
.modal-box { background: #1e2129; border-radius: 12px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; padding: 20px; box-shadow: 0 8px 30px rgba(0,0,0,0.5); border: 1px solid #262a33; }
.modal-box h2 { margin: 0 0 16px; font-size: 17px; color: #fff; }
.modal-box form { display: flex; flex-direction: column; gap: 12px; }
.modal-box input, .modal-box select { padding: 12px; border: 1px solid #30343e; border-radius: 8px; font-size: 16px; width: 100%; background: #14161c; color: #fff; }
.modal-box .readonly-field { padding: 12px; background: #14161c; border-radius: 8px; font-size: 15px; color: #c7ccd6; }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions button { flex: 1; padding: 12px; border-radius: 8px; font-size: 15px; border: none; }
.modal-actions .cancel-btn { background: #262a33; color: #c7ccd6; }
.modal-actions .save-btn { background: #2ecc71; color: #0c0c0c; font-weight: 700; }
.modal-actions .danger-btn { background: transparent; color: #ff6b6b; border: 1px solid #ff5c5c; flex: 0 0 auto; padding: 12px 16px; }

.autocomplete-wrap { position: relative; }
.suggestions { position: absolute; z-index: 5; background: #1e2129; border: 1px solid #30343e; border-radius: 8px; width: 100%; max-height: 220px; overflow-y: auto; }
.suggestion-item { padding: 10px; border-bottom: 1px solid #262a33; font-size: 14px; color: #eaeaea; }
.suggestion-item .tag { float: right; font-size: 11px; color: #6b7280; }

/* ---- Bottom action bar (mirrors the reference screenshot) ---- */
.bottom-bar { position: sticky; bottom: 0; display: flex; justify-content: space-around; background: #1a1d24; border-top: 1px solid #262a33; padding: 10px 0; margin-top: 16px; }
.bottom-bar button { background: none; border: none; color: #c7ccd6; font-size: 20px; padding: 6px 14px; border-radius: 8px; }
.bottom-bar button:active { background: #262a33; }

@media (max-width: 480px) {
    .modal-box { max-width: 100%; border-radius: 12px 12px 0 0; align-self: flex-end; max-height: 85vh; }
    .modal-overlay { align-items: flex-end; padding: 0; }
    .topbar h1 { font-size: 15px; }
    .stock-name { font-size: 14px; }
    .price-main { font-size: 14px; }
}
