* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.5;
    padding-top: 2rem;
    padding-bottom: 4rem;
}

h1,
h2,
h3,
h4 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* === Layout === */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    margin-bottom: 2rem;
    text-align: center;
}

.header h1 {
    font-size: 24px;
    color: #1d1d1f;
}

.main-layout {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* === Connection Bar === */
.connection-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 8px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.migration-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
}

.btn-migration {
    background: #0071e3;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-migration:hover {
    background: #0077ed;
}

.connection-status {
    font-size: 12px;
    color: #86868b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
}

.status-dot.online {
    background: #34c759;
}

.status-dot.offline {
    background: #ff9f0a;
}

/* === Input Card === */
.input-card {
    background: white;
    padding: 32px;
    border-radius: 20px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.04);
}

.card-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 12px;
}

.card-header h2 {
    font-size: 17px;
    color: #1d1d1f;
}

/* === Form === */
.clean-form .form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.clean-form .third {
    flex: 1;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #86868b;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.clean-input,
.clean-form select,
.clean-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    font-size: 15px;
    background: white;
    color: #1d1d1f;
    transition: all 0.2s ease;
}

.clean-input:focus,
.clean-form select:focus,
.clean-form input:focus {
    border-color: #0071e3;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.clean-form textarea {
    resize: vertical;
    min-height: 60px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.btn-primary {
    background: #0071e3;
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #0077ed;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === History Section === */
.history-section h3 {
    font-size: 17px;
    color: #1d1d1f;
    margin-bottom: 20px;
}

/* === Accordions === */
.accordions-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.accordion {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.03);
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: white;
}

.accordion-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    flex: 1;
}

.accordion-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.accordion-arrow {
    font-size: 12px;
    color: #86868b;
    transition: transform 0.2s;
}

.accordion-arrow.expanded {
    color: #0071e3;
}

.accordion-title {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
}

.accordion-notes-preview {
    font-size: 12px;
    color: #86868b;
    font-weight: 400;
    line-height: 1.3;
}

.accordion-count {
    font-size: 12px;
    background: #e5e5ea;
    color: #86868b;
    padding: 2px 8px;
    border-radius: 100px;
    font-weight: 500;
}

.accordion-actions {
    display: flex;
    gap: 4px;
}

.btn-action {
    background: none;
    border: none;
    font-size: 16px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-action:hover {
    background: #f5f5f7;
}

.accordion-content {
    padding: 0 20px 20px;
    border-top: 1px solid #f0f0f0;
}

.accordion-content.hidden {
    display: none;
}

/* === Timeline === */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 16px;
}

.timeline-item {
    position: relative;
    padding-left: 20px;
    border-left: 2px solid #e5e5e5;
}

.timeline-item:last-child {
    border-left-color: transparent;
}

.item-dot {
    position: absolute;
    left: -5px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0071e3;
}

.item-content {
    background: #fbfbfd;
    border-radius: 12px;
    padding: 14px 16px;
}

.item-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.item-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-date {
    font-size: 12px;
    color: #86868b;
    font-weight: 600;
}

.item-author {
    font-size: 11px;
    background: #e5e5ea;
    padding: 2px 8px;
    border-radius: 100px;
    color: #1d1d1f;
    font-weight: 500;
}

.btn-edit {
    background: none;
    border: none;
    font-size: 14px;
    padding: 4px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.btn-edit:hover {
    opacity: 1;
}

.item-problem {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 4px;
}

.item-action {
    color: #424245;
    font-size: 14px;
    line-height: 1.4;
}

.empty-msg {
    color: #86868b;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* === Modals === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-small {
    max-width: 400px;
}

.modal-notes {
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.existing-notes {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 12px;
    background: #fbfbfd;
}

.note-item {
    padding: 10px 0;
    border-bottom: 1px solid #e5e5e5;
}

.note-item:last-child {
    border-bottom: none;
}

.note-header {
    margin-bottom: 4px;
}

.note-date {
    font-size: 11px;
    color: #86868b;
    font-weight: 600;
    text-transform: uppercase;
}

.note-text {
    font-size: 14px;
    color: #1d1d1f;
    line-height: 1.4;
    white-space: pre-wrap;
}

.new-note-section {
    margin-bottom: 16px;
}

.new-note-section label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #86868b;
    margin-bottom: 6px;
    text-transform: uppercase;
}

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

.modal-header h3 {
    font-size: 17px;
    color: #1d1d1f;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #86868b;
    padding: 4px;
}

.btn-icon:hover {
    color: #1d1d1f;
}

.notes-textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 16px;
}

.notes-textarea:focus {
    border-color: #0071e3;
    outline: none;
}

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

/* === Toast === */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    animation: slideUp 0.3s ease;
}

.toast-success {
    background: #1d1d1f;
    color: white;
}

.toast-error {
    background: #ff3b30;
    color: white;
}

.toast.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
    transition: all 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e5e5;
}

.btn-page {
    background: #f5f5f7;
    border: 1px solid #d2d2d7;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-page:hover:not(:disabled) {
    background: #e5e5ea;
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 13px;
    color: #86868b;
}

/* Clickable notes preview */
.accordion-notes-preview {
    cursor: pointer;
}

.accordion-notes-preview:hover {
    text-decoration: underline;
}

/* === Utilities === */
.hidden {
    display: none !important;
}

/* === Responsive === */
@media (max-width: 600px) {
    .clean-form .form-row {
        flex-direction: column;
        gap: 0;
    }

    .input-card {
        padding: 20px;
    }
}