* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #F5F7FB;
    color: #313131;
    min-height: 100vh;
}

body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

a {
    text-decoration: none;
}

::placeholder {
    color: #CFCFCF;
    opacity: 1;
}

::-webkit-input-placeholder { color: #CFCFCF; }
::-moz-placeholder { color: #CFCFCF; opacity: 1; }
:-ms-input-placeholder { color: #CFCFCF; }

/* Login Page */

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 28px 32px;
}

.login-logo {
    display: flex;
    justify-content: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #E5E7EB;
}

.login-logo img {
    height: 48px;
    width: auto;
}

.login-title {
    font-family: 'Roboto', sans-serif;
    font-size: 24px;
    font-weight: 500;
    color: #1D3261;
    margin-top: 24px;
    margin-bottom: 20px;
}

.login-description {
    font-size: 13px;
    font-weight: 400;
    color: #64748B;
    line-height: 1.55;
    margin-top: -12px;
    margin-bottom: 20px;
}

.login-status {
    font-size: 13px;
    color: #16A34A;
    margin-bottom: 12px;
}

.login-form .field {
    margin-bottom: 16px;
}

.login-form label {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: #475569;
    margin-bottom: 4px;
}

.login-form input[type="email"],
.login-form input[type="password"] {
    width: 100%;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    color: #1F2937;
    background: #fff;
}

.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: #5A8CFC;
    box-shadow: 0 0 0 2px rgba(90, 140, 252, 0.25);
}

.login-error {
    font-size: 12px;
    color: #DC2626;
    margin-bottom: 12px;
}

.btn-signin {
    width: 100%;
    background-color: #5A8CFC;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 0;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn-signin:hover {
    background-color: #4a7df0;
}

.forgot-password {
    text-align: center;
    margin-top: 12px;
}

.forgot-password a {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #1D3261;
}

.forgot-password a:hover {
    opacity: 0.8;
}

/* Dashboard Layout */

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */

.sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-logo {
    padding: 0 8px 24px 8px;
}

.sidebar-logo img {
    height: 40px;
    width: auto;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    color: #6A6A6A;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
    background-color: #F1F5F9;
}

.nav-item.active {
    color: #5A8CFC;
}

.nav-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: #6A6A6A;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    transition: background-color 0.15s ease;
}

.nav-icon-dashboard { -webkit-mask-image: url('/images/dashboard.svg'); mask-image: url('/images/dashboard.svg'); }
.nav-icon-tickets   { -webkit-mask-image: url('/images/tickets.svg');   mask-image: url('/images/tickets.svg'); }
.nav-icon-invoices  { -webkit-mask-image: url('/images/invoices.svg');  mask-image: url('/images/invoices.svg'); }
.nav-icon-contracts { -webkit-mask-image: url('/images/contracts.svg'); mask-image: url('/images/contracts.svg'); }
.nav-icon-services  { -webkit-mask-image: url('/images/services.svg');  mask-image: url('/images/services.svg'); }
.nav-icon-estimates { -webkit-mask-image: url('/images/estimates.svg'); mask-image: url('/images/estimates.svg'); }

.nav-item.active .nav-icon {
    background-color: #5A8CFC;
}

.nav-badge {
    width: 28px;
    height: 18px;
    background: #1D3261;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px 0 8px;
    border-top: 1px solid #E5E7EB;
    margin-top: 12px;
}

.user-summary {
    min-width: 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #C8DA2F;
    color: #1D3261;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name {
    display: block;
    font-size: 13px;
    color: #475569;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-button {
    background: none;
    border: 0;
    color: #5A8CFC;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    padding: 2px 0 0;
}

.logout-button:hover {
    text-decoration: underline;
}

/* Main content */

.main {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.main-bg-wave {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 220px;
    background: url('/images/wave.png') no-repeat;
    background-position: right top -205px;
    background-size: 100% auto;
    pointer-events: none;
    z-index: 0;
}

.main-inner {
    position: relative;
    z-index: 1;
    padding: 24px 32px;
}

.main-header {
    margin-bottom: 16px;
}

.main-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #1D3261;
}

.main-header-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-action-header {
    font-weight: 700;
    padding: 7px 16px;
}

/* Stat cards */

.stat-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.stat-card {
    width: 240px;
    height: 106px;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-label {
    font-size: 14px;
    font-weight: 500;
    color: #AAAAAA;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 500;
    color: #1D3261;
}

/* Alerts */

.alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.alert {
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-error {
    background: #FF00041A;
    border: 1px solid #FC5A5D;
    color: #1F2937;
}

.alert-info {
    background: #5A8CFC1A;
    border: 1px solid #5A8CFC;
    color: #1F2937;
}

.alert a {
    color: #5A8CFC;
    text-decoration: underline;
}

/* Dashboard tables */

.dashboard-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.data-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 20px;
}

.data-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.data-card-header h2 {
    font-size: 20px;
    font-weight: 500;
    color: #1D3261;
}

.data-card-actions {
    display: flex;
    gap: 8px;
}

.btn {
    font-size: 14px;
    font-weight: 400;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn-outline {
    background: #fff;
    border-color: #5A8CFC;
    color: #5A8CFC;
}

.btn-outline:hover {
    background: #F0F5FF;
}

.btn-primary {
    background: #5A8CFC;
    color: #fff;
}

.btn-primary:hover {
    background: #4a7df0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    color: #000000;
    background: #F2F6FF;
    padding: 8px 12px;
    border-top: 1px solid #AAAAAA;
    border-bottom: 1px solid #AAAAAA;
}

.data-table td {
    padding: 10px 12px;
    color: #1F2937;
    border-bottom: 1px solid #F1F5F9;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table a {
    font-size: 14px;
    font-weight: 400;
    color: #5A8CFC;
}

.data-table a:hover {
    text-decoration: underline;
}

.status-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 999px;
}

/* Green: open, in progress, paid */
.status-open,
.status-progress,
.status-paid {
    background: #5CAF2926;
    color: #5CAF29;
}

/* Blue: refunded, answered, customer reply, pending client reply */
.status-refunded,
.status-answered,
.status-customer-reply,
.status-pending-reply {
    background: #5A8CFC26;
    color: #4F73C9;
}

/* Orange: pending, in review, estimate sent, create estimate */
.status-pending,
.status-review,
.status-estimate-sent,
.status-create-estimate {
    background: #F59E0B26;
    color: #B45309;
}

/* Purple: scheduled, trying to schedule */
.status-scheduled,
.status-trying-schedule {
    background: #A855F726;
    color: #7E22CE;
}

/* Red: unpaid, overdue, collections, on hold, hold renewal, pending payment */
.status-unpaid,
.status-overdue,
.status-collections,
.status-hold,
.status-hold-renewal,
.status-pending-payment {
    background: #EA363926;
    color: #8C3434;
}

/* Gray: draft, cancelled, closed */
.status-draft,
.status-cancelled,
.status-closed {
    background: #9CA3AF26;
    color: #4B5563;
}

/* Search box */

.search-box {
    position: relative;
    margin-bottom: 12px;
    max-width: 320px;
}

.search-box input {
    width: 100%;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    padding: 7px 36px 7px 12px;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    color: #1F2937;
    background: #fff;
}

.search-box input:focus {
    outline: none;
    border-color: #5A8CFC;
    box-shadow: 0 0 0 2px rgba(90, 140, 252, 0.2);
}

.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background-color: #94A3B8;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat center / contain;
    pointer-events: none;
}

.data-card-spacer {
    margin-top: 16px;
}

/* Slide Panel */

.slide-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 90;
}

.slide-panel-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 600px;
    max-width: 100vw;
    height: 100vh;
    background: #fff;
    border-left: 1px solid #E5E7EB;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 100;
    overflow-y: auto;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.06);
}

.slide-panel.open {
    transform: translateX(0);
}

.slide-panel-inner {
    padding: 28px 32px;
}

.slide-panel-title {
    font-size: 24px;
    font-weight: 500;
    color: #1D3261;
    margin-bottom: 24px;
}

.ticket-form .field {
    margin-bottom: 14px;
}

.ticket-form label {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: #6A6A6A;
    margin-bottom: 6px;
}

.ticket-form input[type="text"],
.ticket-form select,
.ticket-form textarea {
    width: 100%;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    padding: 8px 12px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    color: #1F2937;
    background: #fff;
}

.ticket-form input[type="text"]:focus,
.ticket-form select:focus,
.ticket-form textarea:focus {
    outline: none;
    border-color: #5A8CFC;
    box-shadow: 0 0 0 2px rgba(90, 140, 252, 0.2);
}

.ticket-form textarea {
    resize: vertical;
    height: 270px;
}

.ticket-form select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748B'%3E%3Cpath d='M5 7l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 32px;
}

.btn-attach {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 174px;
    font-size: 14px;
    font-weight: 700;
}

.attach-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    background-color: #5A8CFC;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E") no-repeat center / contain;
}

.attach-hint {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 400;
    color: #AAAAAA;
    line-height: 1.5;
}

.slide-panel-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 20px;
    border-top: 1px solid #E5E7EB;
    margin-top: 20px;
}

.slide-panel-actions .btn-primary {
    width: 93px;
    height: 32px;
    font-size: 14px;
    font-weight: 700;
    padding: 0;
}

.btn-cancel {
    background: none;
    border: 0;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #5A8CFC;
    cursor: pointer;
}

.btn-cancel:hover {
    text-decoration: underline;
}

/* Ticket Detail */

.ticket-detail-header {
    margin-bottom: 16px;
}

.ticket-detail-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #1D3261;
    margin-bottom: 4px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #5A8CFC;
}

.back-link:hover {
    text-decoration: underline;
}

.back-arrow {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #5A8CFC;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M12 19l-7-7 7-7'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M12 19l-7-7 7-7'/%3E%3C/svg%3E") no-repeat center / contain;
}

.ticket-detail-layout {
    display: grid;
    grid-template-columns: 325px 1fr;
    gap: 16px;
    align-items: start;
}

.ticket-detail-sidebar .info-card {
    width: 325px;
}

.ticket-detail-sidebar .info-card:first-child {
    height: 305px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ticket-detail-sidebar .info-card:first-child .info-card-title {
    margin-bottom: 14px;
}

.ticket-detail-sidebar .info-card:first-child .info-list {
    row-gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 0;
}

.ticket-detail-sidebar .info-card:first-child .btn-block {
    margin-top: auto;
    padding: 9px 0;
}

.info-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    margin-bottom: 16px;
}

.info-card-title {
    font-size: 20px;
    font-weight: 500;
    color: #1D3261;
    margin-bottom: 20px;
}

.info-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
    row-gap: 14px;
    align-items: start;
    padding-bottom: 18px;
    border-bottom: 1px solid #E5E7EB;
    margin-bottom: 18px;
}

.info-list dt {
    font-size: 14px;
    font-weight: 400;
    color: #6A6A6A;
}

.info-list dd {
    font-size: 14px;
    color: #1F2937;
    margin-left: 0;
}

.btn-block {
    width: 100%;
    padding: 12px 0;
    font-size: 14px;
    font-weight: 700;
    border-radius: 6px;
}

/* CC Recipients */

.cc-list {
    list-style: none;
    margin-bottom: 12px;
}

.cc-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    color: #1F2937;
}

.cc-remove {
    background: none;
    border: 0;
    color: #94A3B8;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px 4px;
}

.cc-remove:hover {
    color: #475569;
}

.cc-add {
    display: flex;
    gap: 8px;
}

.cc-add input {
    flex: 1;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    padding: 6px 10px;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    color: #1F2937;
}

.cc-add input:focus {
    outline: none;
    border-color: #5A8CFC;
    box-shadow: 0 0 0 2px rgba(90, 140, 252, 0.2);
}

.btn-cc-add {
    padding: 6px 14px;
}

/* Reply form actions */

.ticket-form-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid #E5E7EB;
    margin-top: 16px;
}

.ticket-form-actions .btn-primary {
    width: 93px;
    height: 32px;
    font-size: 14px;
    font-weight: 700;
    padding: 0;
}

/* Messages */

.message-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    margin-bottom: 12px;
    align-items: stretch;
    overflow: hidden;
}

.message-card .message-meta {
    padding: 20px 24px 20px 20px;
    border-right: 1px solid #E5E7EB;
}

.message-card .message-body {
    padding: 20px 20px 20px 24px;
}

.message-meta {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.message-avatar-user {
    background: #C8DA2F;
    color: #1D3261;
    font-size: 12px;
    font-weight: 700;
}

.message-avatar-staff {
    background: #1D3261;
}

.message-avatar-staff img {
    width: 22px;
    height: auto;
}

.message-author {
    font-size: 13px;
    color: #1F2937;
    font-weight: 500;
    line-height: 1.3;
}

.message-date {
    font-size: 12px;
    color: #6A6A6A;
    margin-top: 2px;
}

.message-body p {
    font-size: 14px;
    font-weight: 400;
    color: #6A6A6A;
    line-height: 1.55;
    margin-bottom: 12px;
}

.message-body p:last-child {
    margin-bottom: 0;
}
