:root {
    --primary-color: #14AECC; /* Qs Mall Portal Cyan */
    --primary-hover: #108a9f;
    --secondary-color: #f1f5f9;
    --text-main: #333333;
    --text-muted: #6b7280;
    --bg-main: #fcfcfc;
    --bg-surface: #ffffff;
    --border-color: #e2e8f0;
    
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;

    --sidebar-width: 260px;
    --header-height: 64px;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
    
    --radius-md: 10px;
    --radius-lg: 20px;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Zen Maru Gothic', 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
    letter-spacing: 0.02em;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    font-size: 1.15rem;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: -0.02em;
}

.brand-logo-img {
    height: 44px;
    width: auto;
    object-fit: contain;
    margin-right: 2px;
}

.logo-sign {
    color: #333333;
}

.logo-manager {
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    text-align: left;
    width: 100%;
}

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

/* Dashboard Stats Clickable */
.stat-card.clickable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card.clickable:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.stat-card.clickable:active {
    transform: translateY(-2px);
}


.sidebar-nav li[data-tab="minoh"] { color: var(--primary-color) !important; }
.sidebar-nav li[data-tab="amagasaki"] { color: rgb(255, 222, 101) !important; }
.sidebar-nav li[data-tab="abeno"] { color: rgb(255, 152, 101) !important; }

.sidebar-nav li:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-nav li.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-right: 3px solid currentColor;
}


/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: var(--header-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 5;
    box-shadow: var(--shadow-sm);
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--secondary-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    width: 300px;
}

.search-bar i {
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.875rem;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 30;
}

.stat-card {
    background-color: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: #e0e7ff;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.warning {
    background-color: #fef3c7;
    color: var(--warning-color);
}

.stat-icon.success {
    background-color: #d1fae5;
    color: var(--success-color);
}

.stat-info h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.25rem;
}

/* Mall View specific */
.mall-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    position: sticky;
    top: -2rem;
    z-index: 20;
    background-color: var(--bg-main);
    padding: 2rem 0 1rem 0;
    margin-top: -2rem;
}

.mall-header .page-title {
    margin-bottom: 0;
}

.filters {
    display: flex;
    gap: 1rem;
}

select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    outline: none;
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%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%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1em;
}

select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* Tables */
.table-container {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    /* overflow: hidden; Removed to allow sticky headers inside to work */
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

th, td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 3.3rem; /* Adjusted to close the gap */
    z-index: 10;
    box-shadow: 0 -2px 0 var(--bg-main); /* Fills any subpixel gaps */
}

th::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    border-bottom: 1px solid var(--border-color);
}

th:first-child {
    border-top-left-radius: var(--radius-lg);
}

th:last-child {
    border-top-right-radius: var(--radius-lg);
}

tr:last-child td {
    border-bottom: none;
}

tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius-lg);
}

tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius-lg);
}

tr:hover {
    background-color: #f8fafc;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.status-todo { background-color: #e5e7eb; color: #374151; }
.badge.status-doing { background-color: #fef3c7; color: #b45309; }
.badge.status-done { background-color: #d1fae5; color: #065f46; }

.badge.cat-fashion { background-color: #fcd34d; color: #92400e; }
.badge.cat-food { background-color: #fca5a5; color: #991b1b; }
.badge.cat-service { background-color: #93c5fd; color: #1e3a8a; }
.badge.cat-default { background-color: #e5e7eb; color: #374151; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: var(--shadow-sm);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease-out forwards;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.95) translateY(-20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
}

input:focus,
textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

textarea {
    resize: vertical;
}

/* Checklist */
.checklist-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: 0.7rem;
    max-width: 300px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-main);
    background-color: var(--secondary-color);
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    user-select: none;
    margin-bottom: 0;
}

.checklist-item:hover {
    background-color: #e0e7ff;
    border-color: var(--primary-color);
}

.checklist-item input[type="checkbox"] {
    width: auto;
    cursor: pointer;
    margin: 0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: #333;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Date Toggle UI */
.date-toggle-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--secondary-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    width: 100%;
}

.date-toggle-group input[type="date"] {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    flex: 1;
    min-height: auto !important;
    box-shadow: none !important;
}

.sub-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.planned-month-badge {
    display: inline-block;
    margin-top: 3px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    color: var(--text-main);
}

.checkbox-inline input[type="checkbox"] {
    width: auto !important;
    margin: 0 !important;
}

/* Same Date Row Visual Grouping */
tr.same-date-row td {
    border-bottom: 1px dashed var(--border-color);
}

.recent-tasks h2 {
    position: sticky;
    top: -2rem;
    z-index: 20;
    background-color: var(--bg-main);
    padding: 2rem 0 1rem 0;
    margin-top: -2rem;
    margin-bottom: 1.5rem;
}
