/* ==========================================================================
   sales_space — Clearspace CRM
   Brand: DM Sans, #3BABFF (blue), #323D4C (dark), #16191A (charcoal)
   ========================================================================== */

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

/* Navigation */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.625rem;
    font-size: 1.0625rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    transition: all 0.15s ease;
    letter-spacing: -0.01em;
}
.nav-link:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
}
.nav-link.active {
    color: #fff;
    background: #3BABFF;
    font-weight: 500;
}
.nav-link.active svg {
    color: #fff;
}

/* Cards */
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.875rem;
    padding: 1.75rem;
}
.card-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 1rem;
}

/* Stat cards */
.stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.875rem;
    padding: 1.5rem 1.75rem;
}
.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.stat-value {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.15;
    margin-top: 0.375rem;
    letter-spacing: -0.03em;
}
.stat-sub {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* Forms */
.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.4rem;
    letter-spacing: -0.01em;
}
.input-field {
    display: block;
    padding: 0.5625rem 0.875rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: #fff;
    color: #16191A;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
    box-sizing: border-box;
}
.input-field:focus {
    outline: none;
    border-color: #3BABFF;
    box-shadow: 0 0 0 3px rgba(59, 171, 255, 0.1);
}
.input-field::placeholder {
    color: #d1d5db;
}
select.input-field {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    padding-right: 2.25rem;
    box-sizing: border-box;
    cursor: pointer;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5625rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    background: #3BABFF;
    border-radius: 0.5rem;
    transition: background 0.15s ease;
    letter-spacing: -0.01em;
    font-family: inherit;
}
.btn-primary:hover { background: #2a9aee; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5625rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #323D4C;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: background 0.15s ease;
    letter-spacing: -0.01em;
    font-family: inherit;
}
.btn-secondary:hover { background: #e9eaec; }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5625rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: #6b7280;
    border-radius: 0.5rem;
    transition: color 0.15s ease, background 0.15s ease;
    font-family: inherit;
}
.btn-ghost:hover { color: #16191A; background: #f3f4f6; }

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5625rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #F05A5A;
    background: rgba(240, 90, 90, 0.08);
    border: 1px solid rgba(240, 90, 90, 0.2);
    border-radius: 0.5rem;
    transition: background 0.15s ease;
    font-family: inherit;
}
.btn-danger:hover { background: rgba(240, 90, 90, 0.15); }

/* Tables */
.table-main {
    border-collapse: collapse;
}
.table-main thead {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}
.table-main th {
    padding: 0.875rem 1.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.table-main td {
    padding: 1rem 1.25rem;
    font-size: 0.9375rem;
    border-bottom: 1px solid #f3f4f6;
    color: #16191A;
}
.table-main tbody tr:last-child td {
    border-bottom: none;
}
.table-main tbody tr:hover td {
    background: #fafafa;
}
.table-main tbody tr.bg-brand-blue-dark:hover td {
    background: #323D4C;
}

.table-compact th {
    padding: 0.375rem 0;
    font-size: 0.7rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
}
.table-compact td {
    padding: 0.625rem 0;
    font-size: 0.9375rem;
    border-bottom: 1px solid #f9fafb;
}

/* Stage badges */
.stage-badge {
    display: inline-block;
    padding: 0.2rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    white-space: nowrap;
    letter-spacing: -0.005em;
}
.stage-identified { background: rgba(59, 171, 255, 0.1); color: #3BABFF; }
.stage-qualified { background: rgba(59, 171, 255, 0.2); color: #2a7abf; }
.stage-feasibility { background: rgba(179, 193, 0, 0.15); color: #4a5c1e; }
.stage-on-hold { background: #f3f4f6; color: #9ca3af; }
.stage-closed-won { background: rgba(179, 193, 0, 0.15); color: #3F4D32; }
.stage-closed-lost { background: rgba(240, 90, 90, 0.1); color: #c0392b; }

/* Detail fields */
.detail-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.3rem;
}
.detail-value {
    font-size: 0.9375rem;
    color: #16191A;
    line-height: 1.5;
}

/* Stage steps (pipeline bar) */
.stage-step {
    cursor: pointer;
    border: none;
}
.stage-step:first-child {
    border-radius: 0.5rem 0 0 0.5rem;
}
.stage-step:last-child {
    border-radius: 0 0.5rem 0.5rem 0;
}

/* Tom Select overrides — match .input-field exactly */
.ts-wrapper {
    min-height: 0 !important;
    border: none !important;
    padding: 0 !important;
}
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
    padding: 0.5625rem 0.875rem !important;
    font-size: 0.9375rem !important;
    line-height: 1.5 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.5rem !important;
    background-color: #fff !important;
    color: #16191A !important;
    font-family: inherit !important;
    box-shadow: none !important;
    min-height: 0 !important;
    cursor: pointer;
    height: auto !important;
}
.ts-wrapper.single .ts-control {
    padding-right: 2rem !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
}
.ts-wrapper.single.focus .ts-control,
.ts-wrapper.multi.focus .ts-control {
    border-color: #3BABFF !important;
    box-shadow: 0 0 0 3px rgba(59, 171, 255, 0.1) !important;
}
.ts-wrapper .ts-control > input {
    font-size: 0.9375rem !important;
    font-family: inherit !important;
    color: #16191A !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1.5 !important;
    height: auto !important;
}
.ts-wrapper .ts-control > input::placeholder {
    color: #9ca3af !important;
}
.ts-wrapper .ts-control > .item {
    margin: 0 !important;
    line-height: 1.5 !important;
}
.ts-dropdown {
    font-size: 0.9375rem !important;
    font-family: inherit !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
    margin-top: 4px !important;
    overflow: hidden;
}
.ts-dropdown .ts-dropdown-content {
    max-height: 280px;
    padding: 4px 0;
}
.ts-dropdown .option {
    padding: 0.5rem 0.875rem !important;
    font-size: 0.9375rem !important;
    cursor: pointer;
}
.ts-dropdown .option.active {
    background: rgba(59, 171, 255, 0.08) !important;
    color: #16191A !important;
}
.ts-dropdown .option:hover {
    background: #f9fafb;
}
.ts-wrapper.multi .ts-control > .item {
    background: rgba(59, 171, 255, 0.1) !important;
    color: #16191A !important;
    border: none !important;
    border-radius: 0.375rem !important;
    padding: 0.125rem 0.5rem !important;
    margin: 0.125rem 0.25rem 0.125rem 0 !important;
    font-size: 0.8125rem !important;
    line-height: 1.5 !important;
}
.ts-wrapper.multi .ts-control > .item .remove {
    border: none !important;
    font-size: 1rem;
}

/* Quick link buttons (opportunity detail sidebar — top of right col) */
.quick-link-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    border-radius: 0.625rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    width: 100%;
}
.quick-link-btn:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.07);
}
.quick-link-btn-empty {
    border-style: dashed;
    background: #fafafa;
}
.quick-link-btn-empty:hover {
    border-color: #3BABFF;
    background: rgba(59, 171, 255, 0.03);
    box-shadow: none;
}
.quick-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    flex-shrink: 0;
}
.quick-link-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
    letter-spacing: -0.01em;
}

/* Link buttons (opportunity detail sidebar) */
.link-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.625rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.link-btn:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.link-btn-empty {
    border-style: dashed;
    border-color: #e5e7eb;
    background: #fafafa;
}
.link-btn-empty:hover {
    border-color: #3BABFF;
    background: rgba(59, 171, 255, 0.03);
    box-shadow: none;
}
.link-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.375rem;
    flex-shrink: 0;
}

/* Flash messages auto-dismiss */
.flash-msg {
    animation: flashIn 0.3s ease;
}
@keyframes flashIn {
    from { opacity: 0; transform: translateY(-0.5rem); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ── Auth Pages ── */
.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
}
.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}
.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f8fafc;
    margin: 0;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}
.login-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 36px;
}
.login-brand {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.login-subtitle {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 28px;
}
.login-field {
    margin-bottom: 16px;
}
.login-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #334155;
}
.login-field input {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
    color: #0f172a;
    background: #fff;
    box-sizing: border-box;
}
.login-field input:focus {
    border-color: #3BABFF;
    box-shadow: 0 0 0 3px rgba(59, 171, 255, 0.1);
}
.login-field input::placeholder {
    color: #94a3b8;
}
.login-btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 500;
    background: #323D4C;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 8px;
    font-family: inherit;
    transition: background 0.15s;
}
.login-btn:hover {
    background: #16191A;
}
.login-btn-microsoft {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 500;
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
    box-sizing: border-box;
}
.login-btn-microsoft:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}
.login-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    gap: 12px;
}
.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}
.login-divider span {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
