/* ===========================================
 * LogbookPRO Pages CSS
 * User-facing pages styles
 * =========================================== */

/* ===========================================
 * Base Styles (from header.inc)
 * =========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans CJK JP", sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

/* Header */
.header {
  background: #2c3e50;
  color: #fff;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.header h1 .site-title-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
}
.header h1 .site-title-link:hover {
  opacity: 0.8;
}
.header h1 .site-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

/* Header Navigation */
.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.header-nav a {
  color: #fff;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.header-nav a:hover {
  opacity: 1;
}
.header-nav .nav-divider {
  opacity: 0.3;
}
.header-nav .user-name {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  cursor: default;
}
.header-nav .user-name::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 0.35rem;
  vertical-align: -2px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='rgba(255,255,255,0.9)'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
  background-size: contain;
}

/* Mode Switch Button */
.mode-switch {
  background: #e74c3c;
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  opacity: 1 !important;
  transition: background 0.2s;
}
.mode-switch:hover {
  background: #c0392b;
}

/* Notification Badge */
.notification-badge {
  position: relative;
  display: inline-block;
}
.notification-badge .badge-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #e74c3c;
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Container & Card */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}
.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.card h3 {
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #1a252f;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s;
  background: #e9ecef;
  color: #333;
}
.btn:hover {
  background: #dee2e6;
}
.btn-primary {
  background: #3498db;
  color: #fff;
}
.btn-primary:hover {
  background: #2980b9;
}
.btn-danger {
  background: #e74c3c;
  color: #fff;
}
.btn-danger:hover {
  background: #c0392b;
}
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}
.btn-google {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-google:hover {
  background: #f8f8f8;
}

/* Push Notification Toggle */
.push-notification-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.8;
  transition: opacity 0.2s;
  position: relative;
}
.push-notification-toggle:hover {
  opacity: 1;
}
.push-notification-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
.push-notification-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  color: #fff;
}
.push-notification-toggle.subscribed svg {
  color: #f1c40f;
}
.push-notification-toggle .bell-slash {
  display: none;
}
.push-notification-toggle.unsubscribed .bell-icon {
  display: none;
}
.push-notification-toggle.unsubscribed .bell-slash {
  display: inline;
}
.push-notification-toggle[title]:hover::after {
  content: attr(title);
  position: absolute;
  top: 100%;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
  margin-top: 4px;
}

/* Base Responsive */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }
  .header h1 {
    font-size: 1.25rem;
  }
  .header-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
  .header-nav .nav-divider {
    display: none;
  }
  .header-nav .user-name {
    order: 10;
    width: 100%;
    text-align: center;
    margin-top: 0.25rem;
    padding: 0.5rem;
  }
  .header-nav a[href="/logout"] {
    order: 11;
  }
  .mode-switch {
    padding: 0.5rem 0.75rem;
  }
  .container {
    padding: 1rem;
  }
  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  .btn {
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
  }
  .btn-lg {
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0.5rem 0.75rem;
  }
  .header h1 {
    font-size: 1.1rem;
  }
  .header-nav {
    font-size: 0.8rem;
    gap: 0.4rem 0.6rem;
  }
  .container {
    padding: 0.75rem;
  }
  .card {
    padding: 0.875rem;
    border-radius: 6px;
  }
}

/* ===========================================
 * Login Page Styles
 * =========================================== */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 200px);
  padding: 2rem 1rem;
}
.login-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.login-card h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  color: #333;
}
.login-subtitle {
  color: #666;
  margin: 0 0 2rem 0;
  font-size: 0.9rem;
}
.login-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: #999;
  font-size: 0.85rem;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #ddd;
}
.login-divider span {
  padding: 0 1rem;
}
.login-form {
  text-align: left;
}
.login-form .form-group {
  margin-bottom: 1rem;
}
.login-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  color: #555;
}
.login-form input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  box-sizing: border-box;
}
.login-form input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
.login-form input:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}
.btn-block {
  width: 100%;
}
.login-form .btn-primary {
  display: block;
  padding: 0.75rem 1rem;
  background: #3498db;
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.login-form .btn-primary:hover:not(:disabled) {
  background: #2980b9;
}
.login-form .btn-primary:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .login-container {
    padding: 1rem;
  }
  .login-card {
    padding: 1.5rem;
  }
}

/* ===========================================
 * Password Change Page Styles
 * =========================================== */
.page-header {
  margin-bottom: 1.5rem;
}
.page-header h2 {
  margin: 0;
  font-size: 1.5rem;
}
.page-header .subtitle {
  color: #666;
  margin: 0.5rem 0 0 0;
}
.password-form .form-group {
  margin-bottom: 1.25rem;
}
.password-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #333;
}
.password-form .required {
  color: #e74c3c;
}
.password-form input[type="password"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  box-sizing: border-box;
}
.password-form input[type="password"]:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
.hint {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #666;
}
.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}
.btn-secondary {
  background: #95a5a6;
  color: #fff;
}
.btn-secondary:hover {
  background: #7f8c8d;
}
.requirements-list {
  margin: 0;
  padding-left: 1.5rem;
  color: #666;
}
.requirements-list li {
  margin-bottom: 0.5rem;
}

/* ===========================================
 * Attendance Index Page Styles
 * =========================================== */
.attendance-status {
  margin: 2rem 0;
  text-align: center;
}
.status-text {
  font-size: 1.2rem;
  color: #666;
}
.status-working {
  color: #27ae60;
}
.status-completed {
  color: #3498db;
}
.clock-time {
  margin: 1rem 0;
  font-size: 1.1rem;
}
.clock-form {
  margin-top: 1.5rem;
}
.btn-clock {
  font-size: 1.25rem;
  padding: 1rem 3rem;
  min-width: 200px;
}
.holiday-notice {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
  display: inline-block;
}
.holiday-notice.half-day {
  background: #e3f2fd;
  border-color: #2196f3;
}
.holiday-text {
  color: #856404;
  font-weight: 500;
  margin: 0;
}
.half-day .holiday-text {
  color: #0d47a1;
}
.status-sub {
  font-size: 0.875rem;
  color: #666;
  margin: 0.25rem 0 0 0;
}
.btn-clock-in {
  background: #3498db;
  color: #fff;
}
.btn-clock-in:hover {
  background: #2980b9;
}
.btn-clock-out {
  background: #e74c3c;
  color: #fff;
}
.btn-clock-out:hover {
  background: #c0392b;
}
.action-buttons {
  margin-top: 2rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.info-table {
  border-collapse: collapse;
  margin: 1rem auto;
}
.info-table th,
.info-table td {
  padding: 0.5rem 1rem;
  text-align: left;
}
.info-table th {
  color: #666;
  font-weight: normal;
}
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th,
.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #eee;
  text-align: left;
}
.data-table th {
  background: #f8f8f8;
  font-weight: 600;
}

@media (max-width: 768px) {
  .attendance-status {
    margin: 1.5rem 0;
  }
  .btn-clock {
    width: 100%;
    font-size: 1.3rem;
    padding: 1.25rem 2rem;
  }
  .action-buttons {
    flex-direction: column;
  }
  .action-buttons .btn {
    width: 100%;
    text-align: center;
    padding: 1rem;
  }
  .info-table {
    width: 100%;
  }
  .info-table th,
  .info-table td {
    padding: 0.75rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .status-text {
    font-size: 1.1rem;
  }
  .btn-clock {
    font-size: 1.2rem;
    padding: 1.1rem 1.5rem;
  }
  .holiday-notice {
    padding: 0.75rem 1rem;
  }
}

/* ===========================================
 * Attendance Edit Page Styles
 * =========================================== */
.edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.day-nav {
  display: flex;
  gap: 0.5rem;
}
.form-section {
  margin-top: 2rem;
}
.form-section:first-of-type {
  margin-top: 0;
}
.form-section h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #3498db;
}
.section-desc {
  color: #666;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.note-group {
  margin-top: 1rem;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

/* Form Row Layout - Grouped inputs */
.form-row-group {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.form-row-group:last-of-type {
  margin-bottom: 0;
}
.form-row-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #dee2e6;
}
.form-row-label .label-note {
  font-weight: normal;
  color: #999;
  font-size: 0.75rem;
  margin-left: 0.5rem;
}
.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-row .form-group {
  flex: 1;
  min-width: 120px;
}
.form-row .form-group-wide {
  flex: 2;
  min-width: 200px;
  max-width: 300px;
}

.form-group {
  display: flex;
  flex-direction: column;
}
.form-group label {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 0.25rem;
}
.form-control {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}
.form-control:focus {
  outline: none;
  border-color: #3498db;
}
.report-checked-badge {
  display: inline-block;
  background: #28a745;
  color: #fff;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}
.time-summary {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.time-summary-item {
  display: flex;
  flex-direction: column;
}
.time-summary-label {
  font-size: 0.75rem;
  color: #666;
}
.time-summary-value {
  font-size: 1.25rem;
  font-weight: 600;
}
.time-warning {
  background: #fff3cd;
  color: #856404;
  padding: 0.75rem;
  border-radius: 4px;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}
.time-ok {
  background: #d4edda;
  color: #155724;
  padding: 0.75rem;
  border-radius: 4px;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

/* Project Search Combobox */
.project-search-container {
  position: relative;
  margin-bottom: 1rem;
}
.search-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.combobox-wrapper {
  position: relative;
  width: 100%;
  max-width: 400px;
}
.combobox-input {
  width: 100%;
  padding-right: 36px;
}
.combobox-toggle {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 34px;
  background: #f8f9fa;
  border: none;
  border-left: 1px solid #ddd;
  border-radius: 0 3px 3px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.combobox-toggle:hover {
  background: #e9ecef;
}
.combobox-arrow {
  font-size: 0.65rem;
  color: #666;
  transition: transform 0.2s;
}
.combobox-wrapper.open .combobox-arrow {
  transform: rotate(180deg);
}
.combobox-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #3498db;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 100;
}
.combobox-wrapper.open .combobox-dropdown {
  display: block;
}
.combobox-wrapper.open .combobox-input {
  border-color: #3498db;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.combobox-section-header {
  padding: 0.5rem 0.75rem;
  background: #f8f9fa;
  font-size: 0.7rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  border-bottom: 1px solid #eee;
}
.combobox-item {
  padding: 0.625rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s;
}
.combobox-item:hover,
.combobox-item.highlighted {
  background: #e3f2fd;
}
.combobox-item:last-child {
  border-bottom: none;
}
.combobox-item .project-no {
  font-size: 0.7rem;
  color: #fff;
  background: #6c757d;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  flex-shrink: 0;
}
.combobox-item .project-name {
  flex: 1;
  font-size: 0.875rem;
}
.combobox-item .customer {
  font-size: 0.7rem;
  color: #999;
}
.combobox-item.already-added {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f8f8f8;
}
.combobox-item.already-added:hover {
  background: #f8f8f8;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #666;
  cursor: pointer;
  white-space: nowrap;
}
.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.no-results {
  padding: 1rem;
  color: #666;
  text-align: center;
  font-size: 0.875rem;
}
.btn-remove {
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.btn-remove:hover {
  background: #c82333;
}
.project-memo {
  width: 100%;
  min-width: 200px;
  resize: vertical;
  font-size: 0.875rem;
}

/* Flex Info Box */
.flex-info-box {
  background: #e3f2fd;
  border: 1px solid #90caf9;
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1rem;
}
.flex-info-box h4 {
  margin: 0 0 0.75rem 0;
  color: #1565c0;
  font-size: 0.875rem;
}
.flex-info-content p {
  margin: 0.5rem 0;
  font-size: 0.875rem;
}
.flex-info-content .flex-note {
  color: #666;
  font-size: 0.8rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #90caf9;
}

/* Table Columns */
.col-hours {
  width: 100px;
}
.col-action {
  width: 50px;
}

@media (max-width: 768px) {
  .edit-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .edit-header h2 {
    font-size: 1.25rem;
  }
  .day-nav {
    width: 100%;
  }
  .day-nav .btn {
    flex: 1;
    text-align: center;
  }
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .form-control {
    font-size: 16px;
  }
  .search-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .combobox-wrapper {
    max-width: 100%;
  }
  .table-responsive {
    margin: 0 -0.875rem;
    padding: 0 0.875rem;
  }
  .data-table {
    min-width: 500px;
  }
  .project-memo {
    min-width: 150px;
  }
  .project-hours-input {
    width: 70px !important;
  }
  .time-summary {
    gap: 1rem;
  }
  .time-summary-item {
    min-width: calc(50% - 0.5rem);
  }
  .form-actions {
    flex-direction: column;
  }
  .form-actions .btn {
    width: 100%;
    text-align: center;
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .time-summary-item {
    min-width: 100%;
  }
  .time-summary-value {
    font-size: 1.1rem;
  }
  .data-table th,
  .data-table td {
    padding: 0.5rem 0.25rem;
    font-size: 0.8rem;
  }
}

/* ===========================================
 * Monthly Attendance Page Styles
 * =========================================== */
.month-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.month-title-area {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.month-selector select {
  padding: 0.375rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  background: #fff;
}
.month-selector select:hover {
  border-color: #3498db;
}
.month-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.month-nav {
  display: flex;
  gap: 0.5rem;
}
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.download-btn svg {
  flex-shrink: 0;
}
.summary-box {
  display: flex;
  gap: 2rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 4px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.summary-item {
  display: flex;
  flex-direction: column;
}
.summary-item .label {
  font-size: 0.75rem;
  color: #666;
}
.summary-item .value {
  font-size: 1.25rem;
  font-weight: bold;
}
.summary-item .sub-label {
  display: block;
  font-size: 0.625rem;
  color: #888;
  margin-top: 0.125rem;
}
.summary-item .value.surplus {
  color: #27ae60;
}
.summary-item .value.deficit {
  color: #e74c3c;
}
.deficit-note {
  color: #e74c3c !important;
}
.overtime-negative {
  color: #e74c3c;
}
.calendar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 600px;
}
.calendar-table th,
.calendar-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #eee;
  text-align: center;
  white-space: nowrap;
}
.calendar-table th {
  background: #f8f8f8;
  font-weight: 600;
}
.calendar-table tr.weekend {
  background: #fafafa;
  color: #999;
}
.calendar-table tr.weekend td:nth-child(2) {
  color: #e74c3c;
}
.calendar-table tr.today {
  background: #e3f2fd;
}
.calendar-table tr.holiday {
  background: #fff5f5;
}
.calendar-table tr.holiday td:nth-child(2) {
  color: #e74c3c;
}
.holiday-name {
  display: block;
  font-size: 0.625rem;
  color: #e74c3c;
  white-space: nowrap;
}
.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: #f0f0f0;
  border-radius: 3px;
  text-decoration: none;
  color: #333;
  display: inline-block;
}
.btn-small:hover {
  background: #e0e0e0;
}
.back-link {
  margin-top: 2rem;
}

/* Flex Balance Box */
.flex-balance-box {
  background: #f0f7ff;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.flex-balance-box h3 {
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  color: #555;
  border-bottom: none;
  padding-bottom: 0;
}
.flex-balance-box .summary-box {
  background: #fff;
  margin-bottom: 0;
}

/* Substitute Balance Box */
.substitute-balance-box {
  background: #fff8e1;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid #ffe082;
}
.substitute-balance-box h3 {
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  color: #f57c00;
  border-bottom: none;
  padding-bottom: 0;
}
.substitute-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.substitute-summary .count {
  font-weight: 600;
  color: #e65100;
  font-size: 1.1rem;
}
.substitute-summary .hours {
  color: #666;
  font-size: 0.875rem;
}
.substitute-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
}
.substitute-table th,
.substitute-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #f5f5f5;
}
.substitute-table th {
  background: #fff3e0;
  font-weight: 600;
  font-size: 0.75rem;
  color: #666;
}
.substitute-table td {
  color: #333;
}
.substitute-table tr:last-child td {
  border-bottom: none;
}
.substitute-table tr.expiring-soon {
  background: #fff3e0;
}
.substitute-table tr.expired {
  background: #ffebee;
  color: #c62828;
}
.substitute-table .not-set {
  color: #999;
  font-size: 0.75rem;
}
.substitute-table .warning {
  color: #e65100;
  font-weight: 500;
}
.substitute-table .expire-warning {
  display: inline-block;
  background: #ff6f00;
  color: #fff;
  font-size: 0.625rem;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  margin-left: 0.25rem;
}
.substitute-note {
  margin: 0.75rem 0 0 0;
  padding-top: 0.75rem;
  border-top: 1px dashed #ffe082;
  font-size: 0.75rem;
  color: #666;
}

@media (max-width: 768px) {
  .month-header {
    flex-direction: column;
    align-items: stretch;
  }
  .month-title-area {
    justify-content: space-between;
    width: 100%;
  }
  .month-header h2 {
    font-size: 1.25rem;
  }
  .month-actions {
    width: 100%;
    justify-content: space-between;
  }
  .month-nav {
    flex: 1;
  }
  .month-nav .btn {
    flex: 1;
    text-align: center;
  }
  .download-btn {
    white-space: nowrap;
  }
  .summary-box {
    gap: 1rem;
  }
  .summary-item {
    min-width: calc(50% - 0.5rem);
  }
  .summary-item .value {
    font-size: 1.1rem;
  }
  .table-responsive {
    margin: 0 -0.875rem;
    padding: 0 0.875rem;
  }
  .calendar-table {
    font-size: 0.8rem;
  }
  .calendar-table th,
  .calendar-table td {
    padding: 0.4rem 0.25rem;
  }
  .back-link .btn {
    width: 100%;
    text-align: center;
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .summary-item {
    min-width: 100%;
  }
  .calendar-table {
    font-size: 0.75rem;
  }
  .btn-small {
    padding: 0.4rem 0.6rem;
    font-size: 0.7rem;
  }
  .substitute-table {
    font-size: 0.75rem;
  }
  .substitute-table th,
  .substitute-table td {
    padding: 0.375rem 0.5rem;
  }
}

/* ===========================================
 * Notifications Page Styles
 * =========================================== */
.page-header .header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.unread-badge {
  background: #e74c3c;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.notification-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s, box-shadow 0.2s;
}
.notification-item:hover {
  background: #f8f9fa;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.notification-item.unread {
  background: #fff8e1;
  border-left: 3px solid #f39c12;
}
.notification-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.notification-icon.vacation_pending {
  background: #fff3e0;
  color: #f57c00;
}
.notification-icon.vacation_confirmed {
  background: #e8f5e9;
  color: #2e7d32;
}
.notification-icon.vacation_rejected {
  background: #fafafa;
  color: #757575;
}
.notification-icon.report_submitted {
  background: #e3f2fd;
  color: #1976d2;
}
.notification-icon.other {
  background: #f5f5f5;
  color: #616161;
}
.notification-icon.clock_in {
  background: #e8f5e9;
  color: #2e7d32;
}
.notification-icon.clock_out {
  background: #ffebee;
  color: #c62828;
}
.notification-icon.auto_clockout {
  background: #fff3e0;
  color: #e65100;
}

/* Notification Date Grouping */
.notification-date-group {
  margin-bottom: 1.5rem;
}
.notification-date-group:last-child {
  margin-bottom: 0;
}
.notification-date-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid #e0e0e0;
}
.notification-date-header .date-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #333;
}
.notification-date-header .date-count {
  font-size: 0.75rem;
  color: #666;
  background: #f0f0f0;
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
}

.notification-content {
  flex: 1;
  min-width: 0;
}
.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}
.notification-type {
  font-size: 0.75rem;
  color: #666;
  background: #f0f0f0;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}
.notification-time {
  font-size: 0.75rem;
  color: #999;
}
.notification-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.notification-message {
  font-size: 0.875rem;
  color: #666;
  line-height: 1.4;
}
.notification-sender {
  font-size: 0.75rem;
  color: #999;
  margin-top: 0.5rem;
}
.notification-unread-indicator {
  width: 8px;
  height: 8px;
  background: #f39c12;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.5rem;
}
.no-data {
  text-align: center;
  color: #666;
  padding: 2rem;
}

/* ===========================================
 * Tab Navigation Styles
 * =========================================== */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 1.5rem;
}
.tab-item {
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  color: #666;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tab-item:hover {
  color: #333;
  background: #f8f9fa;
}
.tab-item.active {
  color: #3498db;
  border-bottom-color: #3498db;
  font-weight: 600;
}
.tab-badge {
  background: #e74c3c;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.tab-count {
  font-size: 0.8rem;
  color: #999;
  font-weight: normal;
}
.tab-content {
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 480px) {
  .tab-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tab-item {
    padding: 0.625rem 1rem;
    white-space: nowrap;
    font-size: 0.875rem;
  }
}

/* ===========================================
 * Vacation Page Styles
 * =========================================== */
.help-text {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 1rem;
}
.no-data .sub-text {
  font-size: 0.8rem;
  color: #999;
  margin-top: 0.5rem;
}
.fiscal-year-label {
  font-size: 0.875rem;
  font-weight: normal;
  color: #666;
}
.badge-vacation {
  background: #e3f2fd;
  color: #1565c0;
}
.vacation-summary-card {
  background: linear-gradient(135deg, #e3f2fd 0%, #f5f5f5 100%);
  border: 1px solid #bbdefb;
}
.vacation-summary-card h3 {
  margin-bottom: 1rem;
}
.vacation-summary {
  padding: 0;
}
.vacation-summary .summary-items {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.vacation-summary .summary-item {
  background: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.vacation-summary .summary-item-primary {
  background: #1565c0;
  color: #fff;
}
.vacation-summary .summary-item-primary .summary-label,
.vacation-summary .summary-item-primary .summary-value {
  color: #fff;
}
.vacation-summary .summary-item-primary .summary-detail {
  color: rgba(255,255,255,0.85);
  font-size: 0.75rem;
  width: 100%;
  margin-top: 0.25rem;
}
.vacation-summary .summary-label {
  font-size: 0.85rem;
  color: #666;
}
.vacation-summary .summary-value {
  font-weight: 600;
  color: #1565c0;
  font-size: 1.1rem;
}
.vacation-summary .summary-detail {
  font-size: 0.75rem;
  color: #888;
}
.no-data-text {
  color: #888;
  font-size: 0.9rem;
}

.vacation-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.vacation-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #f39c12;
}
.vacation-item.pending {
  border-left-color: #f39c12;
}
.vacation-info {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.vacation-date {
  text-align: center;
  min-width: 60px;
}
.vacation-date .date {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a252f;
}
.vacation-date .weekday {
  font-size: 0.875rem;
  color: #666;
}
.vacation-detail {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.vacation-detail .event-name {
  font-weight: 600;
  font-size: 1rem;
}
.vacation-detail .detected-type,
.vacation-detail .detected-at {
  font-size: 0.75rem;
  color: #666;
}
.vacation-detail .badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: #e9ecef;
  border-radius: 4px;
  font-weight: 500;
}
.vacation-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.vacation-actions .form-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.vacation-actions .form-group label {
  font-size: 0.75rem;
  color: #666;
  white-space: nowrap;
}
.vacation-actions select {
  padding: 0.375rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.875rem;
}
.confirm-form,
.reject-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-success {
  background: #27ae60;
  color: #fff;
}
.btn-success:hover {
  background: #219a52;
}
.status {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}
.status-pending {
  background: #fff3e0;
  color: #f57c00;
}
.status-confirmed {
  background: #e8f5e9;
  color: #2e7d32;
}
.status-rejected {
  background: #fafafa;
  color: #9e9e9e;
}

/* ===========================================
 * Common Alert Styles
 * =========================================== */
.alert {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}
.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}
.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* ===========================================
 * Paid Leave Balance Card (User Page)
 * =========================================== */
.paid-leave-balance-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  margin-bottom: 1.5rem;
}
.paid-leave-balance-card h3 {
  color: rgba(255, 255, 255, 0.95);
  border-bottom-color: rgba(255, 255, 255, 0.3);
  margin-bottom: 1rem;
}
.paid-leave-balance-card .fiscal-year-label {
  font-weight: normal;
  color: rgba(255, 255, 255, 0.8);
}
.paid-leave-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.paid-leave-balance .balance-main {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.paid-leave-balance .balance-number {
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
}
.paid-leave-balance .balance-number.negative {
  color: #ffccbc;
}
.paid-leave-balance .balance-unit {
  font-size: 1.5rem;
  opacity: 0.9;
}
.paid-leave-balance .balance-breakdown {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.paid-leave-balance .breakdown-item {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
}
.paid-leave-balance .breakdown-label {
  font-size: 0.75rem;
  opacity: 0.85;
  margin-bottom: 0.25rem;
}
.paid-leave-balance .breakdown-value {
  font-size: 1rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .paid-leave-balance {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
  .paid-leave-balance .balance-number {
    font-size: 2.75rem;
  }
  .paid-leave-balance .balance-unit {
    font-size: 1.25rem;
  }
  .paid-leave-balance .balance-breakdown {
    width: 100%;
    justify-content: space-between;
  }
  .paid-leave-balance .breakdown-item {
    flex: 1;
    min-width: 60px;
    padding: 0.5rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .paid-leave-balance .balance-number {
    font-size: 2.5rem;
  }
  .paid-leave-balance .breakdown-item {
    padding: 0.375rem 0.25rem;
  }
  .paid-leave-balance .breakdown-label {
    font-size: 0.7rem;
  }
  .paid-leave-balance .breakdown-value {
    font-size: 0.9rem;
  }
}

/* Paid Leave Balance - Unset State */
.paid-leave-balance-unset {
  padding: 1.5rem;
  text-align: center;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px dashed #d1d5db;
}
.paid-leave-balance-unset .unset-message {
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}
.paid-leave-balance-unset .unset-sub {
  font-size: 0.875rem;
  color: #9ca3af;
}

/* ===========================================
 * Vacation Calendar
 * =========================================== */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.calendar-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  border-bottom: none;
  padding-bottom: 0;
}
.vacation-calendar {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.vacation-calendar th,
.vacation-calendar td {
  border: 1px solid #e0e0e0;
  text-align: center;
  vertical-align: top;
  padding: 0.5rem;
  min-height: 70px;
}
.vacation-calendar th {
  background: #f5f5f5;
  font-weight: 600;
  font-size: 0.875rem;
  height: auto;
  padding: 0.5rem;
}
.vacation-calendar th.sunday {
  color: #e53935;
}
.vacation-calendar th.saturday {
  color: #1976d2;
}
.vacation-calendar td.sunday {
  background: #fff8f8;
}
.vacation-calendar td.saturday {
  background: #f8f9ff;
}
.vacation-calendar td.empty {
  background: #fafafa;
}
.vacation-calendar td.holiday {
  background: #fce4ec;
}
.vacation-calendar td.holiday .day-number {
  color: #e53935;
}
.vacation-calendar td.today {
  background: #fff9c4;
  border: 2px solid #fbc02d;
}
.vacation-calendar td.has-vacation {
  background: #e8f5e9;
}
.vacation-calendar .day-number {
  font-size: 0.875rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 0.25rem;
}
.vacation-calendar .holiday-name {
  font-size: 0.55rem;
  color: #c62828;
  line-height: 1.2;
  margin-bottom: 2px;
}
.legend-color.holiday-bg {
  display: inline-block;
  width: 14px;
  height: 14px;
  background: #fce4ec;
  border: 1px solid #e53935;
  border-radius: 2px;
  margin-right: 4px;
}
.vacation-calendar td.sunday .day-number {
  color: #e53935;
}
.vacation-calendar td.saturday .day-number {
  color: #1976d2;
}
.vacation-markers {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: stretch;
}
.vacation-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.6rem;
  font-weight: 500;
  padding: 0.125rem 0.25rem;
  border-radius: 3px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vacation-marker .marker-name {
  margin-right: 2px;
}
.vacation-marker.mine {
  font-weight: 700;
  box-shadow: 0 0 0 2px #1565c0;
}
.vacation-marker.full {
  background: #4caf50;
}
.vacation-marker.half {
  background: #ff9800;
}
.calendar-legend {
  margin-top: 1rem;
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #666;
}
.legend-item .vacation-marker {
  font-size: 0.625rem;
  display: inline-block;
}

/* Calendar Toggle */
.calendar-toggle {
  text-align: center;
  margin-bottom: 1rem;
}
.toggle-btn {
  display: inline-flex;
  border: 1px solid #3498db;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  padding: 0;
  font-size: 0.875rem;
}
.toggle-option {
  padding: 0.375rem 1rem;
  color: #3498db;
  transition: all 0.2s;
}
.toggle-option.active {
  background: #3498db;
  color: #fff;
}

/* Calendar Responsive */
@media (max-width: 768px) {
  .vacation-calendar th,
  .vacation-calendar td {
    padding: 0.25rem;
    height: auto;
    min-height: 50px;
    font-size: 0.75rem;
  }
  .vacation-calendar .day-number {
    font-size: 0.75rem;
  }
  .vacation-marker {
    font-size: 0.5rem;
    padding: 0.125rem 0.125rem;
  }
  .vacation-marker .marker-name {
    display: none;
  }
  .vacation-calendar .holiday-name {
    display: none;
  }
  .calendar-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .calendar-title {
    order: -1;
    width: 100%;
    text-align: center;
  }
  .vacation-calendar td.has-vacation,
  .vacation-calendar td.holiday {
    cursor: pointer;
  }
}

/* Vacation Popup (SP) */
.vacation-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.vacation-popup {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: 16px 16px 0 0;
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
  animation: popupSlideUp 0.2s ease-out;
}
@keyframes popupSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.vacation-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
}
.vacation-popup-date {
  font-weight: 700;
  font-size: 1.1rem;
  color: #333;
}
.vacation-popup-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}
.vacation-popup-body {
  padding: 0.75rem 1.25rem 1.25rem;
}
.popup-vacation-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9375rem;
  color: #333;
}
.popup-vacation-item:last-child {
  border-bottom: none;
}
.popup-vacation-item.mine {
  font-weight: 700;
}
.popup-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.popup-dot.full {
  background: #4caf50;
}
.popup-dot.half {
  background: #ff9800;
}
.popup-dot.holiday {
  background: #e53935;
}
.popup-holiday-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
  border-bottom: 1px solid #eee;
  color: #c62828;
  font-weight: 600;
}
