/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #1a1a1a; background: #f5f5f5; line-height: 1.6; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Navbar ---- */
.navbar { display: flex; align-items: center; justify-content: space-between; background: #1e293b; color: #fff; padding: .75rem 1.5rem; }
.navbar-brand { font-size: 1.25rem; font-weight: 700; color: #fff; }
.navbar-brand:hover { text-decoration: none; }
.navbar-links { display: flex; align-items: center; gap: 1.25rem; }
.navbar-links a { color: #cbd5e1; }
.navbar-links a:hover { color: #fff; text-decoration: none; }
.navbar-left { display: flex; align-items: center; gap: 1rem; }
.navbar-user { color: #94a3b8; font-size: .85rem; }
.navbar-time { color: #94a3b8; font-size: .85rem; }
.tz-switcher { display: inline-flex; gap: .25rem; }
.tz-option { all: unset; color: #94a3b8; font-size: .85rem; cursor: pointer; font-family: inherit; }
.tz-option:hover { color: #cbd5e1; }
.tz-option.tz-active { text-decoration: underline; }

/* ---- Container ---- */
.container { max-width: 1100px; margin: 2rem auto; padding: 0 1.5rem; }

/* ---- Messages ---- */
.messages { margin-bottom: 1.5rem; }
.alert { padding: .75rem 1rem; border-radius: 6px; margin-bottom: .5rem; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef9c3; color: #854d0e; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ---- Buttons ---- */
.btn { display: inline-block; padding: .6rem 1.25rem; border: none; border-radius: 6px; font-size: .95rem; cursor: pointer; text-align: center; transition: background .15s; }
.btn:hover { text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-google { background: #4285f4; color: #fff; font-size: 1.1rem; padding: .75rem 2rem; }
.btn-google:hover { background: #3367d6; }
.btn-secondary { background: #64748b; color: #fff; }
.btn-secondary:hover { background: #475569; }
.btn-watch { background: transparent; color: #2563eb; border: 1px solid #2563eb; padding: .5rem 1rem; font-size: .85rem; }
.btn-watch:hover { background: #2563eb; color: #fff; }

/* ---- Login ---- */
.login-container { text-align: center; margin-top: 8rem; }
.login-container h1 { font-size: 2rem; margin-bottom: .5rem; }
.login-container p { color: #64748b; margin-bottom: 2rem; }

/* ---- Landing Grid ---- */
.landing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; margin-top: 1.5rem; }
.landing-card { background: #fff; border-radius: 10px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column; }
.landing-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); transform: translateY(-2px); text-decoration: none; }
.landing-card .card-icon { font-size: 2rem; margin-bottom: .5rem; }
.landing-card .card-title { font-size: 1.15rem; font-weight: 600; color: #1a1a1a; }
.landing-card .card-desc { font-size: .9rem; color: #64748b; margin-top: .25rem; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
th, td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { background: #f8fafc; font-weight: 600; color: #475569; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: .5rem .75rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: .95rem; }
.form-group textarea { min-height: 120px; font-family: inherit; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.25rem; }

/* ---- Detail Pages ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem; }
.page-header h1 { font-size: 1.75rem; }
.page-header .actions { display: flex; gap: .5rem; }
.meta { color: #64748b; font-size: .85rem; margin-bottom: 1rem; }
.content-body { background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); line-height: 1.7; }
.content-body h1, .content-body h2, .content-body h3 { margin-top: 1.25rem; margin-bottom: .5rem; }
.content-body p { margin-bottom: .75rem; }
.content-body code { background: #f1f5f9; padding: .1rem .35rem; border-radius: 3px; font-size: .9em; }
.content-body pre { background: #1e293b; color: #e2e8f0; padding: 1rem; border-radius: 6px; overflow-x: auto; margin-bottom: 1rem; }
.content-body pre code { background: transparent; color: inherit; padding: 0; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; text-transform: uppercase; }
.badge-critical { background: #fee2e2; color: #991b1b; }
.badge-high { background: #ffedd5; color: #9a3412; }
.badge-medium { background: #fef9c3; color: #854d0e; }
.badge-low { background: #dbeafe; color: #1e40af; }
.badge-open { background: #fee2e2; color: #991b1b; }
.badge-investigating { background: #ffedd5; color: #9a3412; }
.badge-mitigated { background: #fef9c3; color: #854d0e; }
.badge-resolved { background: #dcfce7; color: #166534; }
.badge-closed { background: #f1f5f9; color: #475569; }
.badge-in_progress { background: #dbeafe; color: #1e40af; }
.badge-merged { background: #e9d5ff; color: #6b21a8; }

/* ---- Comments ---- */
.comment-list { margin-top: 2rem; }
.comment { background: #fff; padding: 1rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: .75rem; }
.comment .comment-meta { font-size: .8rem; color: #64748b; margin-bottom: .35rem; }
.comment .comment-body { font-size: .95rem; }

/* ---- Severity selector ---- */
.severity-select option[value="critical"] { color: #991b1b; }
.severity-select option[value="high"] { color: #9a3412; }
.severity-select option[value="medium"] { color: #854d0e; }
.severity-select option[value="low"] { color: #1e40af; }

/* ---- Landing App Buttons ---- */
.landing-welcome { margin-bottom: 2rem; }
.landing-welcome h1 { font-size: 2rem; }
.section-heading { margin-top: 3rem; margin-bottom: 1rem; font-size: 1.35rem; }
.app-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.app-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #fff; border-radius: 12px; padding: 1.25rem 1rem; box-shadow: 0 2px 8px rgba(0,0,0,.09); transition: box-shadow .2s, transform .2s; text-align: center; cursor: pointer; border: 2px solid transparent; }
.app-btn:hover { box-shadow: 0 6px 20px rgba(0,0,0,.14); transform: translateY(-3px); text-decoration: none; border-color: #e2e8f0; }
.app-btn svg { width: 36px; height: 36px; margin-bottom: .6rem; }
.app-btn-title { font-size: 1rem; font-weight: 700; color: #1a1a1a; margin-bottom: .2rem; }
.app-btn-desc { font-size: .8rem; color: #64748b; line-height: 1.4; }

/* ---- Ticket Two-Column Layout ---- */
.ticket-layout { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
@media (max-width: 768px) { .ticket-layout { grid-template-columns: 1fr; } }
.ticket-main { min-width: 0; }
.ticket-sidebar { display: flex; flex-direction: column; gap: 1rem; }

/* ---- Sidebar Cards ---- */
.sidebar-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 1rem 1.25rem; }
.sidebar-card h3 { font-size: .9rem; text-transform: uppercase; letter-spacing: .03em; color: #475569; margin-bottom: .75rem; }
.sidebar-row { display: flex; justify-content: space-between; align-items: center; padding: .3rem 0; font-size: .9rem; }
.sidebar-label { color: #64748b; font-weight: 600; }
.sidebar-customer { display: flex; justify-content: space-between; align-items: center; padding: .35rem 0; border-bottom: 1px solid #f1f5f9; font-size: .9rem; }
.sidebar-customer:last-of-type { border-bottom: none; }
.customer-mrr { color: #64748b; font-size: .85rem; }
.sidebar-mrr-total { display: flex; justify-content: space-between; align-items: center; padding-top: .75rem; margin-top: .5rem; border-top: 2px solid #e2e8f0; font-size: .9rem; }

/* ---- MRR Change in Comments ---- */
.mrr-change { background: #eff6ff; color: #1e40af; font-size: .85rem; padding: .3rem .6rem; border-radius: 4px; margin-bottom: .35rem; display: inline-block; }

/* ---- Autocomplete Dropdown ---- */
.autocomplete-dropdown { position: absolute; left: 0; right: 0; background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.12); z-index: 100; max-height: 240px; overflow-y: auto; display: none; margin-top: 2px; }
.autocomplete-item { padding: .5rem .75rem; cursor: pointer; font-size: .95rem; }
.autocomplete-item:hover { background: #eff6ff; }
.autocomplete-empty { color: #64748b; cursor: default; }
.autocomplete-empty:hover { background: transparent; }

/* ---- Chips / Tags ---- */
.chip-container { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: #e0e7ff; color: #3730a3; padding: .25rem .6rem; border-radius: 999px; font-size: .85rem; font-weight: 500; }
.chip-remove { all: unset; cursor: pointer; font-size: 1rem; line-height: 1; color: #6366f1; padding: 0 .15rem; }
.chip-remove:hover { color: #dc2626; }

/* ---- Small Button ---- */
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }

/* ---- Attachments ---- */
.attachments-section { margin-top: 2rem; }
.attachments-section h2, .attachments-section h3 { margin-bottom: .75rem; }
.attachment-row { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid #f1f5f9; font-size: .9rem; }
.attachment-row:last-of-type { border-bottom: none; }
.attachment-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-delete { all: unset; cursor: pointer; color: #dc2626; font-size: 1.1rem; line-height: 1; padding: 0 .25rem; }
.attachment-delete:hover { color: #991b1b; }
.attachment-upload { display: flex; align-items: center; gap: .5rem; margin-top: .75rem; }
.attachment-upload input[type="file"] { font-size: .85rem; }

/* ---- Collapsible Panels (details/summary) ---- */
.comment-extras-panel,
.customer-changes-panel { margin-top: .75rem; }
.comment-extras-panel > summary,
.customer-changes-panel > summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: #475569; padding: .4rem 0; user-select: none; }
.comment-extras-panel > summary:hover,
.customer-changes-panel > summary:hover { color: #1e293b; }
.comment-extras-content,
.customer-changes-content { padding: .75rem 0 .25rem; }
