:root {
     --apple-blue: #007aff;
     --apple-light-gray: #f2f2f7;
     --apple-dark-gray: #1d1d1f;
     --apple-white: #ffffff;
     --apple-separator: #e5e5ea;
     --apple-red-btn: #ff3b30;
     --apple-green: #34c759;
     --border-radius-large: 18px;
     --border-radius-medium: 12px;
     --border-radius-small: 8px;
     --orange: #FF732D;
     --red: #F32F2F;
}
body {
     font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
     background-color: var(--apple-light-gray);
     color: var(--apple-dark-gray);
     margin: 0;
     padding: 20px;
     -webkit-font-smoothing: antialiased;
     -moz-osx-font-smoothing: grayscale;
}
.header {
     display: flex;
     justify-content: space-between;
     align-items: center;
     padding: 10px 20px;
     background-color: rgba(255, 255, 255, 0.85);
     backdrop-filter: blur(10px);
     -webkit-backdrop-filter: blur(10px);
     border-radius: var(--border-radius-medium);
     margin-bottom: 30px;
     box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
     position: sticky;
     top: 20px;
     z-index: 1000;
}
.header h1 {
     font-size: 24px; margin: 0; font-weight: 600; display: flex; align-items: center;
}
#tour-counter {
     font-size: 18px;
     font-weight: 500;
     color: #888;
     margin-left: 10px;
     background-color: var(--apple-light-gray);
     padding: 2px 8px;
     border-radius: var(--border-radius-small);
}
.header-controls {
     display: flex; align-items: center; gap: 10px;
}
.header-controls .main-btn {
     font-size: 16px;
     font-weight: 500;
     color: var(--apple-white);
     background-image: linear-gradient(90deg, var(--orange) 0%, var(--red) 100%);
     border: none;
     padding: 10px 20px;
     border-radius: var(--border-radius-small);
     cursor: pointer;
     white-space: nowrap;
}
.header-controls .main-btn:hover { opacity: 0.9; }

.icon-header-btn {
     display: flex;
     align-items: center;
     justify-content: center;
     padding: 9px;
     background-image: linear-gradient(90deg, var(--orange) 0%, var(--red) 100%);
     border: none;
     border-radius: var(--border-radius-small);
     cursor: pointer;
}
.icon-header-btn:hover {
     opacity: 0.9;
}
.icon-header-btn svg {
     width: 20px;
     height: 20px;
     fill: var(--apple-white);
}

.dropdown { position: relative; display: inline-block; }
.dropdown-content {
     display: none;
     position: absolute;
     right: 0;
     background-color: var(--apple-white);
     min-width: 220px;
     box-shadow: 0 8px 25px rgba(0,0,0,0.15);
     border-radius: var(--border-radius-medium);
     z-index: 1001;
     overflow: hidden;
     margin-top: 8px;
     border: 1px solid rgba(0,0,0,0.05);
}
.dropdown-content a, .dropdown-content label { color: var(--apple-dark-gray); padding: 12px 16px; text-decoration: none; display: block; font-size: 15px; cursor: pointer; border-bottom: 1px solid var(--apple-separator); }
.dropdown-content a:last-child, .dropdown-content label:last-child { border-bottom: none; }
.dropdown-content a:hover, .dropdown-content label:hover { background-color: var(--apple-light-gray); }
.show { display: block; }
#file-upload { display: none; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.view-switcher {
     display: flex;
     background-color: var(--apple-separator);
     border-radius: var(--border-radius-small);
     padding: 3px;
     margin-right: 10px;
}
.view-switcher button {
     background: transparent;
     border: none;
     padding: 6px 12px;
     border-radius: 6px;
     font-size: 14px;
     font-weight: 500;
     cursor: pointer;
     color: #555;
     display: flex;
     align-items: center;
     gap: 5px;
}
.view-switcher button.active {
     background-color: var(--apple-white);
     color: var(--apple-dark-gray);
     box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.view-switcher svg { width: 16px; height: 16px; }

#tour-grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 25px; }
#tour-table-view { display: none; }

.tour-card, .tour-table { background: var(--apple-white); border-radius: var(--border-radius-large); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07); overflow-x: auto; }
.tour-card:hover { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12); }
.tour-card img { width: 100%; height: 200px; object-fit: cover; }
.card-content { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; }
.card-editable-field { position: relative; margin-bottom: 10px; }
.card-editable-field .edit-icon { position: absolute; top: 6px; right: 5px; width: 16px; height: 16px; fill: #c5c5c7; opacity: 0; pointer-events: none; }
.card-editable-field:hover .edit-icon { opacity: 1; }
.card-title-input, .card-desc-textarea { width: 100%; border: none; background: transparent; font-family: inherit; padding: 4px 25px 4px 0; margin: 0; resize: none; box-sizing: border-box; }
.card-title-input { font-size: 20px; font-weight: 600; color: var(--apple-dark-gray); }
.card-desc-textarea { font-size: 14px; color: #666; line-height: 1.5; overflow: hidden; }
.char-counter { font-size: 11px; color: #aaa; text-align: right; display: block; margin-top: -4px; padding-right: 5px; }
.card-details { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; font-size: 14px; margin-top: 15px; }
.card-details-item { background-color: var(--apple-light-gray); padding: 8px 10px; border-radius: var(--border-radius-small); display: flex; align-items: center; overflow: hidden; gap: 8px; }
.card-details-item.full-width { grid-column: 1 / -1; }
.card-details-item > span { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.card-details-item input { background: transparent; border: none; width: 100%; font-family: inherit; font-size: inherit; color: inherit; padding: 0;}
.card-details-item input:focus { outline: none; }
.card-icon { width: 16px; height: 16px; flex-shrink: 0; }
.price-value { font-weight: 600; color: var(--apple-green); display: flex; align-items: center; }
.card-features { padding: 0 20px 20px 20px; }
.card-features textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--apple-separator); border-radius: var(--border-radius-small); padding: 8px; font-family: inherit; font-size: 13px; resize: vertical; min-height: 60px; }
.card-actions { border-top: 1px solid var(--apple-separator); padding: 15px 20px; display: flex; justify-content: flex-end; gap: 10px; background-color: #fafafc; }
.card-actions a, .card-actions button { text-decoration: none; font-size: 15px; font-weight: 500; border: none; padding: 8px 18px; border-radius: var(--border-radius-small); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; } /* Text alignment fix */
.view-btn { background-color: var(--apple-green); color: var(--apple-white); }
.view-btn:hover { opacity: 0.9; }
.edit-btn { background-color: #e5e5ea; color: var(--apple-dark-gray); }
.edit-btn:hover { background-color: #dcdce1; }
.delete-btn { background-color: var(--apple-red-btn); color: var(--apple-white); }
.delete-btn:hover { background-color: #d13026; }

/* --- НОВЫЕ И ИЗМЕНЕННЫЕ СТИЛИ --- */
#feed-filename {
    font-family: inherit;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: var(--border-radius-small);
    border: 1px solid var(--apple-separator);
    background-color: var(--apple-white);
    margin-right: 10px;
    width: 200px;
}
.tour-table table { border-collapse: collapse; width: 100%; }
.tour-table th, .tour-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--apple-separator); font-size: 14px; vertical-align: top; }
.tour-table th { background-color: #f7f7f8; font-size: 14px; font-weight: 600; white-space: nowrap; }
.tour-table tr:hover { background-color: #f9f9f9; }
.tour-table .inline-input, .tour-table .inline-textarea { width: 100%; box-sizing: border-box; border: 1px solid transparent; padding: 5px; border-radius: 4px; background: transparent; font-family: inherit; font-size: inherit; }
.tour-table .inline-textarea { resize: vertical; min-height: 50px; }
.tour-table .inline-input:focus, .tour-table .inline-textarea:focus { border-color: var(--apple-blue); background: white; box-shadow: 0 0 0 1px var(--apple-blue); }
.tour-table .table-actions { display: flex; gap: 5px; align-items: center; }
.tour-table .table-actions button, .tour-table .table-actions a {
    display: flex; align-items: center; justify-content: center; box-sizing: border-box;
    width: 32px; height: 32px; border-radius: var(--border-radius-small);
    border: 1px solid transparent; padding: 0; font-size: 0;
}
.tour-table .table-actions .view-btn svg { fill: white; }
.tour-table .table-actions svg { width: 18px; height: 18px; }
.table-thumbnail { width: 60px; height: 40px; border-radius: var(--border-radius-small); object-fit: cover; display: block; }
.table-char-counter { font-size: 11px; color: #aaa; text-align: right; display: block; margin-top: 2px; }
/* --- КОНЕЦ БЛОКА СТИЛЕЙ --- */

.modal-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(5px);display:none;justify-content:center;align-items:center;z-index:1001;padding:20px 0}
.modal{z-index:1002;background:var(--apple-white);padding:30px;border-radius:var(--border-radius-large);width:90%;max-width:700px;max-height:90vh;overflow-y:auto;box-shadow:0 10px 40px rgba(0,0,0,0.2);position:relative}
.modal-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:25px;border-bottom:1px solid var(--apple-separator);padding-bottom:15px}
.modal-header h2{margin:0;font-size:22px;font-weight:600}
.modal-close-btn{font-size:30px;font-weight:300;color:#888;background:none;border:none;cursor:pointer;line-height:1}
.modal-form{display:flex;flex-direction:column;gap:15px}
.form-group{display:flex;flex-direction:column}
.form-group .label-wrapper { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.form-group label{font-weight:500;font-size:14px;color:#333}
.form-group input,.form-group textarea,.form-group select{padding:12px;border-radius:var(--border-radius-small);border:1px solid var(--apple-separator);font-size:16px;font-family:inherit;width:100%;box-sizing:border-box}
.form-group textarea{resize:vertical;min-height:100px}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:15px}
.form-section-title{font-size:18px;font-weight:600;margin-top:20px;margin-bottom:10px;padding-bottom:10px;border-bottom:1px solid var(--apple-separator);grid-column:1 / -1}
.modal-actions{display:flex;justify-content:flex-end;margin-top:25px;gap:10px}
.modal-actions button{font-size:16px;font-weight:500;padding:12px 25px;border-radius:var(--border-radius-small);border:none;cursor:pointer}
.generate-btn { font-size: 14px; padding: 6px 12px; background-color: var(--apple-blue); color: white; border-radius: var(--border-radius-small); border: none; cursor: pointer; display: flex; align-items: center; gap: 8px;}
.generate-btn .loading-icon { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: #fff; animation: spin 1s ease-in-out infinite; }
.generate-btn:disabled { background-color: #ccc; cursor: not-allowed; }
#save-tour-btn{background-color:var(--apple-green);color:white}#cancel-modal-btn{background-color:#e5e5ea;color:var(--apple-dark-gray)}#generated-xml-modal .modal,#utm-settings-modal .modal, #ai-settings-modal .modal{max-width:80vw}#xml-output{width:100%;height:60vh;white-space:pre;font-family:"SF Mono","Menlo","Courier New",monospace;font-size:13px;background-color:#2a2a2e;color:#f2f2f7;border:none;border-radius:var(--border-radius-medium);padding:15px}#utm-presets-list{list-style:none;padding:0;margin:0;max-height:250px;overflow-y:auto;border:1px solid var(--apple-separator);border-radius:var(--border-radius-small)}#utm-presets-list li{display:flex;justify-content:space-between;align-items:center;padding:10px;border-bottom:1px solid var(--apple-separator)}#utm-presets-list li:last-child{border-bottom:none}.preset-details{display:flex;gap:15px;font-size:13px;flex-wrap:wrap}.preset-details strong{font-weight:600}.preset-delete-btn{background:none;border:none;color:var(--apple-red-btn);cursor:pointer;font-size:18px}