/* ===================================
   Tool: shift-maker
   =================================== */

  /* Layout */
  .shift-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: var(--space-xl);
  }
  @media (max-width: 1024px) {
    .shift-layout {
      grid-template-columns: 1fr;
    }
  }

  /* Top Controls */
  .top-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: center;
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-xl);
  }
  .period-group {
    display: flex;
    align-items: flex-end;
    gap: var(--space-md);
    flex-wrap: wrap;
  }
  .period-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .period-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
  }
  .period-separator {
    padding-bottom: var(--space-sm);
    color: var(--text-muted);
  }
  .period-input {
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-main);
    font-size: 0.9rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 40px;
    box-sizing: border-box;
  }
  .period-input:focus {
    outline: none;
    border-color: var(--accent);
  }
  .quick-btns {
    display: flex;
    gap: var(--space-xs);
  }
  .generate-btn {
    margin-left: auto;
  }

  /* Sidebar */
  .shift-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
  }

  /* Panel */
  .panel {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
  }
  .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
  }
  .panel-title {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
  }

  /* Member List */
  .member-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 300px;
    overflow-y: auto;
  }
  .member-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--brown-50);
    border-radius: var(--radius-md);
  }
  .member-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .member-name {
    flex: 1;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .member-skill {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    color: var(--accent);
  }
  .member-actions {
    display: flex;
    gap: var(--space-xs);
  }
  .member-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
  }
  .member-btn:hover {
    background: var(--brown-100);
  }

  /* Member Form */
  .member-form {
    display: grid;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
  }
  .form-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
  }
  .form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-main);
    font-size: 0.9rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 40px;
  }
  .form-input:focus {
    outline: none;
    border-color: var(--accent);
  }
  .form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-main);
    font-size: 0.9rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 40px;
  }
  .form-color {
    width: 100%;
    height: 44px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 0;
  }

  /* Form Group Styles */
  .form-group {
    margin-bottom: var(--space-md);
  }
  .form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-color);
  }
  .form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }
  .field-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
  }
  .form-field-color {
    width: 100%;
  }

  /* Shift Types */
  .shift-type-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
  }
  .shift-type-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--brown-50);
    border-radius: var(--radius-md);
  }
  .shift-type-color {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
  }
  .shift-type-name {
    flex: 1;
    font-size: 0.85rem;
  }
  .shift-type-count {
    font-size: 0.75rem;
    color: var(--text-muted);
  }

  /* Settings */
  .setting-group {
    margin-bottom: var(--space-md);
  }
  .setting-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
  }
  .setting-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
  }
  .checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    cursor: pointer;
  }
  .checkbox-label input {
    width: 16px;
    height: 16px;
    cursor: pointer;
  }

  /* Weekday Settings */
  .weekday-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
  }
  .weekday-col {
    text-align: center;
  }
  .weekday-label {
    font-size: 0.75rem;
    font-weight: 600;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
  }
  .weekday-label.sun {
    background: #fee2e2;
    color: #dc2626;
  }
  .weekday-label.sat {
    background: #dbeafe;
    color: #2563eb;
  }
  .weekday-input {
    width: 100%;
    padding: var(--space-xs);
    font-family: var(--font-main);
    font-size: 0.8rem;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
  }
  .weekday-input:focus {
    outline: none;
    border-color: var(--accent);
  }

  /* Calendar */
  .calendar-container {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
  }
  .calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
  }
  .calendar-nav {
    display: flex;
    align-items: center;
    gap: var(--space-md);
  }
  .calendar-nav-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition-fast);
  }
  .calendar-nav-btn:hover {
    background: var(--brown-50);
    border-color: var(--border-hover);
  }
  .calendar-month {
    font-size: 1.25rem;
    font-weight: 700;
  }
  .calendar-actions {
    display: flex;
    gap: var(--space-sm);
  }

  /* Calendar Grid */
  .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  .calendar-weekday {
    padding: var(--space-sm);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bg-secondary);
  }
  .calendar-weekday.sun {
    color: #dc2626;
  }
  .calendar-weekday.sat {
    color: #2563eb;
  }
  .calendar-cell {
    min-height: 80px;
    padding: var(--space-xs);
    background: var(--bg-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
  }
  .calendar-cell:hover {
    background: var(--brown-50);
  }
  .calendar-cell.empty {
    background: var(--bg-secondary);
    cursor: default;
  }
  .calendar-cell.today {
    background: var(--accent-light);
  }
  .calendar-cell.holiday {
    background: #fef2f2;
  }
  .calendar-cell.sunday {
    background: #fef2f2;
  }
  .calendar-cell.saturday {
    background: #eff6ff;
  }
  .calendar-date {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
  }
  .calendar-date.holiday-date {
    color: #dc2626;
  }
  .holiday-name {
    font-size: 0.6rem;
    color: #dc2626;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .calendar-shifts {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .shift-badge {
    font-size: 0.65rem;
    padding: 2px 4px;
    border-radius: 3px;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Statistics */
  .stats-container {
    margin-top: var(--space-xl);
  }
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
  }
  @media (max-width: 768px) {
    .stats-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  .stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    text-align: center;
  }
  .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
  }
  .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
  }

  /* Member Stats Table */
  .member-stats {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    overflow-x: auto;
  }
  .member-stats-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
  }
  .stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
  }
  .stats-table th,
  .stats-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
  }
  .stats-table th {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--brown-50);
  }
  .stats-table tr:last-child td {
    border-bottom: none;
  }
  .fairness-score {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
  }
  .fairness-score.good {
    background: #d1fae5;
    color: #059669;
  }
  .fairness-score.warn {
    background: #fef3c7;
    color: #d97706;
  }
  .fairness-score.bad {
    background: #fee2e2;
    color: #dc2626;
  }

  /* Warnings */
  .warnings-container {
    margin-top: var(--space-lg);
  }
  .warning-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
  }
  .warning-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: #fef3c7;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: #92400e;
  }
  .warning-item.error {
    background: #fee2e2;
    color: #991b1b;
  }

  /* Save Slots */
  .save-slots {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
  }
  .save-slot {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--brown-50);
    border-radius: var(--radius-md);
  }
  .save-slot-num {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
  }
  .save-slot-name {
    flex: 1;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .save-slot-empty {
    color: var(--text-muted);
    font-style: italic;
  }
  .save-slot-actions {
    display: flex;
    gap: var(--space-xs);
  }

  /* Modal */
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
  }
  .modal-overlay.show {
    opacity: 1;
    visibility: visible;
  }
  .modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform var(--transition-fast);
  }
  .modal-overlay.show .modal {
    transform: scale(1);
  }
  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
  }
  .modal-title {
    font-size: 1.1rem;
    font-weight: 600;
  }
  .modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--brown-100);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
  }
  .modal-close:hover {
    background: var(--brown-200);
  }

  /* NG/Request Calendar in Modal */
  .mini-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-top: var(--space-md);
  }
  .mini-calendar-header {
    padding: var(--space-xs);
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-secondary);
  }
  .mini-calendar-cell {
    padding: var(--space-sm);
    text-align: center;
    font-size: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
  }
  .mini-calendar-cell:hover {
    background: var(--brown-50);
  }
  .mini-calendar-cell.selected-ng {
    background: #fee2e2;
    border-color: #dc2626;
  }
  .mini-calendar-cell.selected-request {
    background: #d1fae5;
    border-color: #059669;
  }
  .mini-calendar-cell.empty {
    background: var(--bg-secondary);
    cursor: default;
  }

  /* Usage Section */
  .usage-section {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    margin-top: var(--space-xl);
  }
  .usage-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
  }
  .usage-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
  }
  .usage-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
  @media (max-width: 600px) {
    .usage-grid {
      grid-template-columns: 1fr;
    }
  }
  .usage-item {
    background: var(--bg-card);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  .usage-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
  .usage-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
  }
  .usage-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
  }
  .usage-desc ul {
    margin: var(--space-xs) 0 0 0;
    padding-left: var(--space-lg);
  }
  .usage-desc li {
    margin-bottom: var(--space-xs);
  }

  /* Trivia Section */
  .trivia-section {
    background: linear-gradient(135deg, var(--brown-50) 0%, var(--bg-card) 100%);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-xl);
  }
  .trivia-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
  }
  .trivia-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
  }
  .trivia-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
  @media (max-width: 600px) {
    .trivia-grid {
      grid-template-columns: 1fr;
    }
  }
  .trivia-item {
    background: var(--bg-primary);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
  }
  .trivia-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: var(--space-xs);
  }
  .trivia-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
  }

  /* Tabs for Algorithm */
  .algo-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
  }
  .algo-tab {
    flex: 1;
    padding: var(--space-sm);
    font-family: var(--font-main);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
  }
  .algo-tab:hover {
    border-color: var(--border-hover);
  }
  .algo-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
  }

  /* Mobile Responsive Styles */
  @media (max-width: 768px) {
    html, body {
      overflow-x: hidden;
      width: 100%;
      max-width: 100vw;
    }

    .tool-main {
      padding: var(--space-lg) var(--space-sm);
      overflow-x: hidden;
      width: 100%;
      max-width: 100%;
      box-sizing: border-box;
    }

    .shift-layout {
      grid-template-columns: 1fr;
      width: 100%;
      max-width: 100%;
    }

    .shift-sidebar {
      width: 100%;
      max-width: 100%;
    }

    .panel {
      overflow-x: auto;
    }

    /* Member Form Mobile */
    .form-input,
    .form-select {
      min-height: 44px;
      font-size: 16px;
    }

    /* Member Item Mobile */
    .member-item {
      flex-wrap: wrap;
      gap: var(--space-xs);
      padding: var(--space-sm);
    }

    .member-name {
      flex: 1 1 calc(100% - 80px);
      min-width: 80px;
    }

    .member-skill {
      order: 3;
    }

    .member-actions {
      order: 4;
      margin-left: auto;
    }

    /* Top Controls Mobile */
    .top-controls {
      flex-direction: column;
      align-items: stretch;
      gap: var(--space-md);
      overflow: hidden;
      width: 100%;
      max-width: 100%;
      box-sizing: border-box;
      padding: var(--space-md);
    }

    .period-group {
      flex-direction: column;
      align-items: stretch;
      width: 100%;
      gap: var(--space-sm);
      box-sizing: border-box;
    }

    .period-field {
      width: 100%;
      max-width: 100%;
      box-sizing: border-box;
    }

    .period-separator {
      text-align: center;
      padding: 0;
    }

    .period-input {
      display: block;
      width: calc(100% - 16px) !important;
      max-width: calc(100% - 16px) !important;
      min-width: 0 !important;
      min-height: 44px;
      font-size: 16px;
      box-sizing: border-box;
      padding: var(--space-sm);
      margin: 0 auto;
    }

    .quick-btns {
      justify-content: center;
    }

    .generate-btn {
      margin-left: 0;
      width: 100%;
    }

    /* Calendar Mobile */
    .calendar-container {
      padding: var(--space-md);
    }

    .calendar-header {
      flex-direction: column;
      gap: var(--space-md);
    }

    .calendar-actions {
      width: 100%;
      justify-content: center;
    }

    .calendar-cell {
      min-height: 60px;
      padding: 2px;
    }

    .calendar-date {
      font-size: 0.7rem;
    }

    .shift-badge {
      font-size: 0.55rem;
      padding: 1px 2px;
    }

    .holiday-name {
      font-size: 0.5rem;
    }

    /* Weekday Grid Mobile */
    .weekday-grid {
      gap: 2px;
    }

    .weekday-input {
      font-size: 0.7rem;
      padding: 4px 2px;
    }

    .weekday-label {
      font-size: 0.65rem;
      padding: 2px;
    }

    /* Algorithm Tabs Mobile */
    .algo-tabs {
      flex-wrap: wrap;
    }

    .algo-tab {
      flex: 1 1 calc(50% - var(--space-xs));
      font-size: 0.7rem;
      padding: var(--space-xs) var(--space-sm);
    }

    /* Stats Mobile */
    .stat-value {
      font-size: 1.5rem;
    }

    .stat-label {
      font-size: 0.75rem;
    }

    /* Table Mobile */
    .stats-table {
      font-size: 0.75rem;
    }

    .stats-table th,
    .stats-table td {
      padding: var(--space-xs) var(--space-sm);
    }

    /* Buttons - Touch Target */
    .btn {
      min-height: 44px;
      padding: var(--space-sm) var(--space-md);
    }

    .btn-sm {
      min-height: 36px;
    }

    .member-btn {
      width: 32px;
      height: 32px;
    }

    /* Save Slots Mobile */
    .save-slot {
      flex-wrap: wrap;
    }

    .save-slot-name {
      flex: 1 1 calc(100% - 60px);
    }

    .save-slot-actions {
      flex-wrap: wrap;
      justify-content: flex-end;
    }
  }

  @media (max-width: 480px) {
    .tool-main {
      padding: var(--space-md) var(--space-sm);
    }

    .panel {
      padding: var(--space-md);
    }

    .form-row {
      flex-direction: column;
    }

    .form-input,
    .form-select {
      flex: 1 1 100%;
      width: 100%;
    }

    .member-item {
      flex-direction: column;
      align-items: flex-start;
    }

    .member-name {
      flex: none;
      width: 100%;
    }

    .member-actions {
      width: 100%;
      justify-content: flex-end;
    }

    /* Calendar - Very Small Screens */
    .calendar-cell {
      min-height: 50px;
    }

    .calendar-weekday {
      font-size: 0.65rem;
      padding: 4px 2px;
    }

    .algo-tab {
      flex: 1 1 100%;
    }

    /* Mini Calendar Modal */
    .mini-calendar-cell {
      padding: var(--space-xs);
      font-size: 0.65rem;
    }

    .mini-calendar-header {
      font-size: 0.6rem;
    }

    .modal {
      padding: var(--space-md);
      width: 95%;
    }
  }

  /* Print Styles */
  @media print {
    .header, .tool-hero, .shift-sidebar, .top-controls, .calendar-actions,
    .usage-section, .trivia-section, .footer, .toast {
      display: none !important;
    }
    .tool-main {
      padding: 0;
      max-width: 100%;
    }
    .calendar-container {
      box-shadow: none;
      padding: var(--space-sm);
    }
    .calendar-cell {
      min-height: 60px;
    }
    .stats-container {
      page-break-before: always;
    }
  }


