:root {
    --color-bg-primary: #000000;
    --color-bg-secondary: #292929;
    --color-bg-tertiary: #060606;
    --color-surface: rgba(255, 255, 255, 0.05);
    --color-surface-hover: rgb(255 255 255 / 18%);
    --color-text-primary: #d0d0d0;
    --color-text-secondary: #b4b4b4;
    --color-accent: hsl(250, 80%, 65%);
    --color-success: hsl(150deg 100% 22.91%);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --transition-normal: 220ms ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

.main-content {
    grid-template-columns: 600px 1fr;
}

.sidebar {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-top-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.search-input {
    width: 100%;
    padding: var(--spacing-sm);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    font-size: 0.95rem;
}

.model-list {
    margin-top: var(--spacing-lg);
    overflow-y: auto;
    padding-right: 6px;
}

.model-list::-webkit-scrollbar {
    width: 8px;
}

.model-list::-webkit-scrollbar-track {
    background: transparent;
}

.model-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.model-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.model-name {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    color: #d3d3d3;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 19px;
    cursor: pointer;
    transition: background var(--transition-normal), color var(--transition-normal);
    overflow: hidden;
}

.completed-task-date {
    display: inline-block;
    min-width: 4.8rem;
    margin-right: 0.2rem;
    color: #9f9f9f;
    font-size: 0.88rem;
    flex-shrink: 0;
}

.completed-task-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.model-name:hover,
.model-name.active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.empty-message {
    color: #a1a1a1;
    font-size: 0.92rem;
}

.editor-placeholder {
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    text-align: center;
    color: var(--color-text-secondary);
}

.editor-placeholder svg {
    width: 5rem;
    height: 5rem;
    margin-bottom: var(--spacing-lg);
    opacity: 0.2;
}

.editor-placeholder h2 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
    color: #bfbfbf;
}

.editor-placeholder p {
    font-size: 1rem;
}

.task-form {
    min-height: calc(100vh - (var(--spacing-xl) * 2));
}

.form-grid {
    flex: 1;
}

.full-width {
    width: 100%;
}

.form-group textarea {
    resize: vertical;
    min-height: 0;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(138, 99, 255, 0.1);
}

.completed-tasks-sidebar-header {
    border-bottom: 0;
}

.form-actions {
    display: flex;
    justify-content: flex-start;
    gap: var(--spacing-sm);
}

.section-header h3 {
    font-size: 1.3rem;
    color: #e1e1e1;
    margin-bottom: 4px;
}

.section-header p {
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}

.dynamic-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dynamic-checkbox-control {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0 2px;
}

.dynamic-checkbox-control input[type="checkbox"] {
    width: 18px;
    height: 18px;
    padding: 0;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.toggle-choice-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 2px;
}

.toggle-choice-option {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-secondary);
    font-size: 0.92rem;
    line-height: 1.35;
    cursor: pointer;
}

.toggle-choice-option input[type="radio"] {
    margin: 0;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.phone-container {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.phone-container input {
    flex: 1;
    min-width: 0;
}

.phone-container-compact input {
    flex: 0 0 220px;
    width: 220px;
}

.sale-field-mci {
    flex-shrink: 0;
}

.sale-field-mci input {
    width: 220px;
    flex-shrink: 0;
}

.sale-field-client {
    flex: 1;
    min-width: 0;
}

.phone-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
    background: var(--color-surface);
    border: 1px solid rgb(0 0 0 / 8%);
    border-radius: var(--radius-sm);
    color: var(--color-accent);
    text-decoration: none;
    transition: all var(--transition-normal);
    flex-shrink: 0;
    width: 48px;
}

.phone-link:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-accent);
    transform: scale(1.05);
}

.phone-link svg {
    width: 1.125rem;
    height: 1.125rem;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    z-index: 1;
    width: min(460px, calc(100% - 32px));
    background: #1b1b1b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 22px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    color: #d2d2d2;
    margin-bottom: 12px;
}

.modal-icon svg {
    width: 24px;
    height: 24px;
}

.modal-title {
    margin: 0 0 8px;
    color: #ececec;
    font-size: 1.2rem;
}

.modal-message {
    margin: 0 0 14px;
    color: #bbbbbb;
    font-size: 0.95rem;
    line-height: 1.45;
}

.modal-input {
    width: 100%;
    margin-bottom: 14px;
    padding: var(--spacing-sm);
    background: var(--color-bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
    color: #cfcfcf;
    font-family: inherit;
    font-size: 1rem;
}

.modal-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(138, 99, 255, 0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary {
    background: var(--color-success);
    color: #fff;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: var(--color-surface-hover);
}

.btn-danger {
    background: hsl(0, 75%, 60%);
    color: #fff;
}

.btn-danger:hover {
    filter: brightness(1.06);
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.25);
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 240px 1fr;
    }

    .sidebar {
        padding: var(--spacing-md);
    }

    .editor {
        padding: var(--spacing-md);
        height: auto;
    }

    .task-form {
        min-height: auto;
    }
}

.tutorial-preview {
    flex: 1;
    min-height: 260px;
    padding: var(--spacing-md);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    white-space: pre-wrap;
    line-height: 1.6;
    font-family: Courier New;
    overflow-y: auto;
}

.completed-task-content {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font: inherit;
    color: inherit;
}

.tutorial-preview .doc-title {
    display: block;
    margin: 0 0 8px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #f0f0f0;
}

.sales-history {
    white-space: normal;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.sales-history-product {
    margin: 0 0 12px;
    color: #e1e1e1;
    font-weight: 600;
}

.sales-history-empty {
    margin: 0;
    color: #b9b9b9;
}

.sales-table {
    width: auto;
    border-collapse: collapse;
    table-layout: auto;
}

.sales-table th,
.sales-table td {
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 8px 10px;
    text-align: left;
    font-size: 0.92rem;
    color: #d0d0d0;
    white-space: nowrap;
    word-break: normal;
    background-color: #000000;
}

.sales-table th {
    background: #292929;
    color: #ececec;
    font-weight: 600;
}

.sales-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

.sales-table tbody tr.sales-row-today td:nth-child(2) {
    /* background: rgb(0 0 0); */
    /* border-color: rgb(0 0 0 / 95%); */
    color: #60fa70;
    /* font-weight: 600; */
}

.sales-history-summary {
    margin: 12px 0 0;
    color: #fff8d2;
    font-size: 0.92rem;
    font-weight: 600;
}

.tutorial-help-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 0 16px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.tutorial-help-item {
    display: grid;
    grid-template-columns: 140px 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.tutorial-help-command {
    color: #d6d6d6;
    font-size: 0.95rem;
    white-space: nowrap;
}

.tutorial-help-sample {
    min-width: 0;
    min-height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    line-height: 1.4;
    overflow: visible;
    color: var(--color-text-primary);
}

#modelHelpModal .modal-content {
    width: min(820px, calc(100% - 32px));
}

#salesReport {
    margin-top: 40px;
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    vertical-align: top;
}

#salesReport.capture-compact .sales-table th,
#salesReport.capture-compact .sales-table td {
    line-height: 1.2;
}

#salesReport.capture-compact .sales-history-summary {
    color: #000000;
}
