/* style.css */
:root {
  --primary-color: #0b1c54;
  --primary-light: #2c428a;
  --bg-color: #f0f4f8;
  --card-bg: #ffffff;
  --text-main: #333333;
  --text-muted: #666666;
  --border-color: #e0e0e0;
  --sidebar-width: 250px;
}

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

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

/* App Layout */
#app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  background-color: var(--primary-color);
  color: white;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  z-index: 1000;
}

.sidebar-header {
  padding: 1.5rem;
  font-size: 1.25rem;
  font-weight: bold;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.nav-links li {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  border-left: 4px solid transparent;
  white-space: nowrap;
}

.nav-links a:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-links a.active {
  background-color: var(--primary-light);
  color: #ffffff;
  font-weight: bold;
  border-left-color: #66c2ff;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background: transparent;
}

.outline-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: transparent;
}

.btn-inline-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: transparent;
}

/* Single-line enforcement utility */
.single-line-row {
  display: flex;
  flex-wrap: nowrap !important;
  align-items: center;
  min-width: 0;
}

/* Mobile Header */
.mobile-header {
  display: none;
  background-color: var(--primary-color);
  color: white;
  padding: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 1001;
  gap: 8px;
}

.mobile-header h1 {
  font-size: clamp(0.95rem, 4vw, 1.2rem);
  white-space: nowrap;
  margin: 0;
}

.mobile-page-badge {
  background-color: var(--primary-light);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: clamp(0.72rem, 3vw, 0.85rem);
  font-weight: bold;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Main Content */
#main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
  height: 100vh;
  overflow-y: auto;
  min-width: 0;
}

/* Page Title Bar (Unified Top-Left Heading inside each View) */
.page-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 1rem;
  min-height: 36px;
}

.page-title-bar h2 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--primary-color);
  font-weight: 800;
  white-space: nowrap;
}

.container {
  padding: 1.5rem 2rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

/* Home View Layout Overrides to prevent scroll */
#main-content:has(#view-home.active) {
  overflow: hidden;
}
#main-content:has(#view-home.active) .container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.25rem 2rem;
}

@media (max-width: 768px) {
  .page-title-bar {
    margin-bottom: 0.65rem;
    min-height: 30px;
  }
  .page-title-bar h2 {
    font-size: 1.15rem;
  }
  #main-content:has(#view-home.active) .container {
    padding: 0.75rem;
  }
}

/* Views */
.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

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

/* Components */
.card {
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.card h2, .card h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  white-space: nowrap;
}
.card h2 {
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 0.5rem;
  font-size: 1.25rem;
}
.card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
}

.form-group { margin-bottom: 1rem; min-width: 0; }
label { display: block; margin-bottom: 0.35rem; font-weight: bold; color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
input, select, textarea { font-size: 1rem; }
input[type="text"], input[type="number"], input[type="date"], select, textarea { width: 100%; min-width: 0; padding: 0.55rem 0.5rem; border: 1px solid var(--border-color); border-radius: 4px; font-size: 1rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-color); }

.edit-team-name-input::placeholder {
  color: #b0b8c4;
  opacity: 1;
  font-weight: normal;
}

button { background-color: var(--primary-color); color: white; border: none; padding: 0.65rem 1.2rem; border-radius: 4px; font-size: 1rem; cursor: pointer; transition: background-color 0.2s ease; font-weight: bold; white-space: nowrap; }
button:hover { background-color: #061036; }
button.danger { background-color: #dc3545; }
button.danger:hover { background-color: #c82333; }
button.success { background-color: #28a745; }
button.success:hover { background-color: #218838; }
button.outline { background-color: white; color: var(--primary-color); border: 1px solid var(--primary-color); }
button.outline:hover { background-color: #f0f4f8; }

.action-bar { display: flex; flex-wrap: nowrap; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); }
.action-bar.between { justify-content: space-between; }

/* Bulk Actions & Lists */
.bulk-actions { display: flex; gap: 10px; margin-bottom: 1.5rem; flex-wrap: nowrap; }
.bulk-actions button { flex: 1; min-width: 0; font-size: 0.9rem; padding: 0.5rem 0.75rem; background-color: var(--primary-light); }
.bulk-actions button:hover { background-color: var(--primary-color); }
.hidden-input { display: none; }
.status-text { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.5rem; display: block; }

.list-header { display: flex; flex-wrap: nowrap; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--primary-light); padding-bottom: 0.5rem; margin-bottom: 1rem; gap: 8px; }
.list-header h2 { border-bottom: none; padding-bottom: 0; margin-bottom: 0; white-space: nowrap; }
.header-actions { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; }

.member-list { list-style: none; }
.member-item { display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: space-between; align-items: center; padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--border-color); gap: 8px; }
.member-item:last-child { border-bottom: none; }
.member-info { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 0.65rem; flex: 1; min-width: 0; }
.jersey-number { background-color: var(--primary-light); color: white; width: 36px; height: 36px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: bold; font-size: 1rem; }
.member-details { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 0.65rem; flex: 1; min-width: 0; }
.member-name { font-weight: bold; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-position { font-size: 0.85rem; color: var(--primary-color); background-color: #e8eef7; padding: 0.15rem 0.5rem; border-radius: 4px; font-weight: bold; white-space: nowrap; flex-shrink: 0; cursor: help; }

.delete-btn, .btn-delete-member { width: auto; padding: 0.4rem 0.75rem; font-size: 0.85rem; flex-shrink: 0; }
.edit-input { padding: 0.35rem 0.4rem; border: 1px solid var(--border-color); border-radius: 4px; font-size: 1rem; min-width: 0; }
.edit-input.number-input { width: 52px; flex-shrink: 0; text-align: center; }
.edit-input.name-input { flex: 1; min-width: 60px; }
.edit-input.pos-input { width: auto; min-width: 72px; flex-shrink: 0; }

/* Readonly styles for Confirm view */
.readonly-field { padding: 0.75rem; background-color: #f8f9fa; border: 1px solid var(--border-color); border-radius: 4px; margin-bottom: 1rem; font-size: 1.1rem; }
.readonly-logo { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; margin-bottom: 1rem; border: 1px solid var(--border-color); flex-shrink: 0; }

/* Score Table */
.score-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  background-color: white;
  min-width: 600px;
}
.score-table th, .score-table td {
  border: 1px solid var(--border-color);
  padding: 0.25rem;
  text-align: center;
  vertical-align: middle;
}
.score-table th {
  background-color: var(--primary-light);
  color: white;
  font-size: 0.9rem;
  padding: 0.5rem;
}
.score-table input[type="text"], .score-table input[type="number"] {
  width: 100%;
  padding: 0.25rem;
  border: 1px solid transparent;
  text-align: center;
  font-size: 1rem;
  border-radius: 0;
}
.score-table input:focus {
  border: 1px solid var(--primary-color);
  background-color: #f8f9fa;
}
.score-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.score-table .score-total {
  font-weight: bold;
}
.score-tfoot td {
  background-color: #f8f9fa;
  font-weight: bold;
  font-size: 1rem;
}
.unmatched-name {
  background-color: #ffe6e6 !important;
  border: 1px solid #ff9999 !important;
}

/* Responsive: Mobile Bottom Navigation & Single-Line Layout */
@media (max-width: 768px) {
  #app {
    flex-direction: column;
  }
  .mobile-header {
    display: flex;
  }
  .app-header {
    display: none;
  }

  #sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 62px;
    transform: none !important;
    flex-direction: row;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.18);
    z-index: 1002;
  }

  .sidebar-header {
    display: none;
  }

  .nav-links {
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    height: 100%;
  }

  .nav-links li {
    flex: 1;
    min-width: 0;
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
  }

  .nav-links li:last-child {
    border-right: none;
  }

  .nav-links a {
    flex: 1;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    padding: 4px 2px;
    border-left: none;
    border-top: 3px solid transparent;
    font-size: clamp(0.6rem, 2.5vw, 0.78rem);
    text-align: center;
  }

  .nav-links a.active {
    border-left-color: transparent;
    border-top-color: #66c2ff;
    background-color: var(--primary-light);
  }

  .nav-icon {
    width: 19px;
    height: 19px;
  }

  .nav-label {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.15;
  }

  #main-content {
    height: calc(100vh - 52px);
    padding-bottom: 72px;
  }

  .container {
    padding: 0.75rem;
  }

  .card {
    padding: 0.9rem;
    margin-bottom: 1rem;
  }

  .member-item {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 6px;
    padding: 0.5rem 0.25rem;
  }

  .delete-btn, .btn-delete-member {
    width: auto !important;
    padding: 0.35rem 0.6rem;
    font-size: 0.78rem;
  }

  input[type="text"], input[type="number"], input[type="date"], select {
    padding: 0.4rem 0.25rem;
  }

  button {
    padding: 0.5rem 0.75rem;
    font-size: clamp(0.75rem, 3.2vw, 0.95rem);
  }
}

/* ==============================
   TACTICAL BOARD
   ============================== */
.court-container {
  position: relative;
  overflow: hidden;
  touch-action: none;
  background-color: #56b4e9;
  flex-shrink: 0;
}
.court-half {
  width: min(100%, 55vh);
  aspect-ratio: 1 / 1;
}
.court-full {
  width: 100%;
  aspect-ratio: 440 / 240;
}

/* SVG Court Lines Layer */
.court-lines {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
}

/* Play button states */
button.play-default {
  background-color: white;
  color: #28a745;
  border: 1px solid #28a745;
}
button.play-default:hover {
  background-color: #f0fdf4;
}
button.play-active {
  background-color: #28a745;
  color: white;
  border: 1px solid #28a745;
}
button.play-active:hover {
  background-color: #218838;
}

/* Fullscreen wrapper */
.fullscreen-mode {
  position: fixed !important;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  background-color: #fff;
  z-index: 9999;
  padding: 10px;
  box-sizing: border-box;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.fullscreen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.fullscreen-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  margin: 0;
}
.fullscreen-mode .board-timeline-wrapper {
  flex-grow: 1;
  overflow: hidden;
  flex-direction: row;
  align-items: center;
  justify-content: center;
}
.fullscreen-mode #formation-edit-controls {
  display: none !important;
}
.fullscreen-mode .court-container {
  flex: 0 1 auto;
  width: 100%;
  height: auto;
  max-height: calc(100% - 150px);
}
.fullscreen-mode .court-half {
  aspect-ratio: 1 / 1;
  max-width: calc(100vh - 180px);
}
.fullscreen-mode .court-full {
  aspect-ratio: 440 / 240;
  max-width: calc((100vh - 180px) * 440 / 240);
}
.fullscreen-mode .timeline-panel {
  flex: 0 0 300px;
  max-height: calc(100% - 100px);
}
@media (max-width: 768px) {
  .fullscreen-mode .board-timeline-wrapper {
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
  }
  .fullscreen-mode .court-container {
    max-height: 50vh;
    margin: 0 auto;
  }
  .fullscreen-mode .court-half {
    max-width: 50vh;
  }
  .fullscreen-mode .court-full {
    max-width: calc(50vh * 440 / 240);
  }
  .fullscreen-mode .timeline-panel {
    flex: 1;
    width: 100%;
    max-width: none;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 1rem;
  }
}

.token {
  position: absolute;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  font-weight: bold;
  color: #fff;
  cursor: grab;
  user-select: none;
  transform: translate(-50%, -50%);
  z-index: 10;
  box-shadow: 1px 1px 4px rgba(0,0,0,0.5);
  transition: top 0.3s linear, left 0.3s linear;
}
.token.dragging {
  cursor: grabbing;
  z-index: 100;
  transition: none !important;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.7);
}
.token-offense { background-color: #1976d2; }
.token-defense { background-color: #d32f2f; }
.token-gk { background-color: #388e3c; }
.token-ball { 
  background-color: #ffeb3b; 
  color: #000; 
  width: 16px; 
  height: 16px; 
  font-size: 0.45rem; 
}

/* Board + Timeline wrapper */
.board-timeline-wrapper {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-top: 1rem;
}

.timeline-panel {
  flex: 1;
  min-width: 120px;
  max-height: 60vh;
  overflow-y: auto;
}
.timeline-panel label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-main);
}
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.timeline-item {
  padding: 0.5rem 0.75rem;
  background-color: #e8eaf0;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.85rem;
  border: 2px solid transparent;
  transition: all 0.15s;
}
.timeline-item:hover {
  background-color: #d0d4e0;
}
.timeline-item.active {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

@media (max-width: 600px) {
  .token {
    width: 22px;
    height: 22px;
    font-size: 0.52rem;
  }
  .token-ball {
    width: 14px;
    height: 14px;
    font-size: 0.42rem;
  }
  .board-timeline-wrapper {
    flex-direction: column;
  }
  .court-half {
    width: min(100%, 60vh);
  }
  .timeline-panel {
    max-height: none;
    width: 100%;
  }
  .timeline-list {
    flex-direction: row;
    overflow-x: auto;
  }
}

/* ==================================================
   HOME VIEW STYLES
   ================================================== */
#view-home.active {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.home-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 1.25rem;
}

.home-quick-access {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.quick-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  font-size: 1.05rem;
  font-weight: bold;
  min-width: 0;
  overflow: hidden;
}

.quick-btn:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
}

.quick-btn .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.45rem;
  background: transparent;
}

.quick-btn-label {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-recent-updates {
  flex: 1;
  min-height: 0;
  background-color: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.recent-title {
  padding: 0.85rem 1.25rem;
  border-bottom: 2px solid var(--primary-light);
  color: var(--primary-color);
  margin: 0;
  flex-shrink: 0;
  font-size: 1.15rem;
}

.recent-list {
  padding: 0.85rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.recent-item {
  background-color: var(--bg-color);
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
  border-left: 4px solid var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.recent-item-body {
  min-width: 0;
  flex: 1;
}

.recent-item.clickable {
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.recent-item.clickable:hover {
  background-color: #e2eaf4;
}

.recent-item.clickable:active {
  transform: scale(0.99);
}

.recent-chevron {
  color: var(--text-muted);
  font-size: 1.15rem;
  font-weight: bold;
  flex-shrink: 0;
  line-height: 1;
}

.recent-date {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.recent-desc {
  font-size: 0.88rem;
  color: var(--text-main);
}

@media (max-width: 768px) {
  .home-layout {
    gap: 0.85rem;
  }
  
  .home-quick-access {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  
  .home-recent-updates {
    flex: 1;
    min-height: 200px;
  }
  
  .quick-btn {
    font-size: clamp(0.68rem, 2.8vw, 0.9rem);
    padding: 0.65rem 0.25rem;
  }
  
  .quick-btn .outline-icon {
    width: 24px;
    height: 24px;
  }
  
  .recent-title {
    padding: 0.6rem 0.9rem;
    font-size: 1rem;
  }
  
  .recent-list {
    padding: 0.6rem 0.9rem;
  }
}

/* ==================================================
   SCORE REGISTRATION (2x2 META, SUBTLE CSV, 2-COL TEAMS)
   ================================================== */
.score-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  margin-bottom: 0.65rem;
}

.score-meta-grid .form-group {
  margin-bottom: 0;
  min-width: 0;
}

.score-meta-grid label {
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
}

.score-meta-grid input,
.score-meta-grid select {
  height: 36px;
  padding: 0.3rem 0.45rem;
  font-size: 0.9rem;
}

.score-csv-actions {
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 0.65rem;
}

button.btn-subtle {
  background-color: #f8f9fa;
  color: var(--text-muted);
  border: 1px solid #ced4da;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.22rem 0.6rem;
  border-radius: 4px;
  width: auto;
}

button.btn-subtle:hover {
  background-color: #e9ecef;
  color: var(--text-main);
}

.score-swap-container {
  text-align: center;
  margin-bottom: 0.75rem;
}

button.btn-swap-teams {
  width: auto;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.score-teams-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.score-team-column {
  min-width: 0;
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem;
}

.score-team-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0.5rem;
}

.score-team-header-top {
  justify-content: space-between;
  gap: 4px;
  height: 26px;
  min-height: 26px;
}

.score-team-header-top h3 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.2;
  color: var(--primary-color);
  white-space: nowrap;
}

.score-team-header-sub {
  height: 28px;
  min-height: 28px;
  align-items: center;
}

.score-team-header-sub input {
  height: 28px;
  padding: 0.2rem 0.4rem;
  font-size: 0.9rem;
  width: 100%;
}

button.btn-compact {
  padding: 0.2rem 0.45rem;
  font-size: 0.74rem;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.score-team-header-sub button.btn-compact {
  height: 28px;
}

.score-tabs {
  display: flex;
  flex-wrap: nowrap;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.score-tab {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.2rem;
  text-align: center;
  background: none;
  border: none;
  font-weight: bold;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.78rem;
  white-space: nowrap;
}

.score-tab.active {
  background-color: var(--primary-color);
  color: white;
}

.score-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

/* Uniform Row Height across 1st Half, 2nd Half, and Penalty tabs */
.score-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  background-color: var(--card-bg);
  padding: 0 0.35rem;
  border-radius: 6px;
  border: 1px solid #e9ecef;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  gap: 4px;
}

.score-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
}

.score-row-info input[data-field=number] {
  width: 36px;
  height: 26px;
  flex-shrink: 0;
  text-align: center;
  padding: 0 0.15rem;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.score-row-info input[data-field=name] {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 26px;
  padding: 0 0.25rem;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.score-input-col {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  flex-shrink: 0;
  height: 26px;
}

.score-step-btn {
  width: 22px;
  height: 26px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.85rem !important;
  font-weight: bold;
  flex-shrink: 0;
  line-height: 1;
  user-select: none;
}

.score-step-btn.minus {
  background-color: #f1f3f5;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.score-step-btn.minus:hover {
  background-color: #e2e6ea;
}

.score-step-btn.plus {
  background-color: var(--primary-color);
  color: #ffffff;
  border: 1px solid var(--primary-color);
}

.score-step-btn.plus:hover {
  background-color: var(--primary-light);
}

.score-input-col input[type=number]::-webkit-inner-spin-button,
.score-input-col input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.score-input-col input[type=number] {
  -moz-appearance: textfield;
  width: 32px;
  height: 26px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: bold;
  border: 1px solid var(--primary-light);
  border-radius: 4px;
  padding: 0;
}

.score-penalty-col {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 3px;
  justify-content: flex-end;
  flex-shrink: 0;
  height: 26px;
}

.penalty-toggle {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: all 0.1s ease;
  flex-shrink: 0;
}

.penalty-toggle.active {
  background-color: var(--primary-light);
  border-color: var(--primary-color);
  transform: scale(0.95);
}

.penalty-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: #d32f2f;
  color: white;
  font-size: 0.56rem;
  font-weight: bold;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

button.score-row-del-btn {
  width: 20px;
  height: 26px;
  padding: 0 !important;
  background-color: transparent;
  color: #adb5bd;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 0.95rem !important;
  font-weight: bold;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

button.score-row-del-btn:hover {
  background-color: #fff5f5;
  color: #dc3545;
  border-color: #ffc9c9;
}

.score-add-row-wrap {
  margin-bottom: 0.5rem;
}

button.btn-add-score-row {
  width: 100%;
  padding: 0.25rem 0.4rem;
  font-size: 0.76rem;
  border-style: dashed;
  border-radius: 6px;
}

.score-totals {
  background-color: var(--card-bg);
  padding: 0.3rem 0.35rem;
  border-radius: 6px;
  text-align: center;
  border: 1px solid var(--primary-light);
  justify-content: center;
  gap: 4px;
  font-size: 0.78rem;
  flex-wrap: nowrap;
  white-space: nowrap;
  height: 34px;
  min-height: 34px;
  margin-bottom: 0.5rem;
}

.score-total-input {
  width: 38px !important;
  height: 24px !important;
  display: inline-block;
  text-align: right;
  padding: 0 0.2rem !important;
  font-size: 0.85rem !important;
  font-weight: bold;
}

.score-totals-sub {
  font-size: 0.72rem;
  white-space: nowrap;
}

.score-totals-pen {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Confirm Summary Board */
.sticky-top {
  position: sticky;
  top: 0;
  z-index: 10;
}

.confirm-summary-board {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  background-color: var(--primary-color);
  color: white;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.team-score-card {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.team-name {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-total {
  font-size: 2rem;
  font-weight: bold;
}

.vs-text {
  font-weight: bold;
  font-size: 1.2rem;
  opacity: 0.8;
  padding: 0 0.75rem;
  flex-shrink: 0;
}

.confirm-row {
  background-color: var(--card-bg);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border-left: 4px solid var(--primary-color);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.confirm-row-top {
  font-weight: bold;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.confirm-row-bottom {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.confirm-penalty-icons {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  font-size: 1.1rem;
}

/* Tab visibilities */
.score-row.show-firstHalf .score-input-col[data-col=firstHalf] { display: flex; }
.score-row.show-firstHalf .score-input-col[data-col=secondHalf] { display: none; }
.score-row.show-firstHalf .score-penalty-col { display: none; }

.score-row.show-secondHalf .score-input-col[data-col=firstHalf] { display: none; }
.score-row.show-secondHalf .score-input-col[data-col=secondHalf] { display: flex; }
.score-row.show-secondHalf .score-penalty-col { display: none; }

.score-row.show-penalty .score-input-col[data-col=firstHalf] { display: none; }
.score-row.show-penalty .score-input-col[data-col=secondHalf] { display: none; }
.score-row.show-penalty .score-penalty-col { display: flex; }

/* ==================================================
   CUSTOM POSITION DROPDOWN (TOOLTIP SUPPORT)
   ================================================== */
.pos-dropdown {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.pos-dropdown-btn {
  background-color: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-size: 0.95rem;
  font-weight: bold;
  min-width: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  cursor: pointer;
}

.pos-dropdown-btn:hover {
  background-color: #f8f9fa;
  border-color: var(--primary-color);
}

.pos-dropdown-arrow {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.pos-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 84px;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  z-index: 2000;
  list-style: none;
  padding: 4px 0;
  max-height: 240px;
  overflow-y: auto;
}

.pos-dropdown.open .pos-dropdown-menu {
  display: block;
}

.pos-dropdown-item {
  padding: 0.45rem 0.75rem;
  font-size: 0.92rem;
  font-weight: bold;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: background-color 0.15s;
  user-select: none;
}

.pos-dropdown-item:hover {
  background-color: #e8eef7;
  color: var(--primary-color);
}

.pos-dropdown-item.selected {
  background-color: var(--primary-color);
  color: #ffffff;
}

/* ==================================================
   CUSTOM TOOLTIP (PC HOVER & MOBILE LONG-PRESS)
   ================================================== */
.custom-tooltip {
  position: fixed;
  z-index: 10005;
  background-color: rgba(11, 28, 84, 0.95);
  color: #ffffff;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: normal;
  line-height: 1.45;
  max-width: min(320px, 92vw);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: pre-line;
  word-break: auto-phrase;
  overflow-wrap: break-word;
}

.custom-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==================================================
   RECORDS VIEW: FILTER GRID, STATS, PERSONAL RECORDS & HISTORY
   ================================================== */
.record-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 10px;
  margin-top: 0.75rem;
  align-items: end;
}

.record-filter-grid .form-group {
  margin-bottom: 0;
  min-width: 0;
}

.record-filter-grid label {
  font-size: 0.76rem;
  margin-bottom: 0.2rem;
}

.record-filter-grid select {
  width: 100%;
  height: 36px;
  padding: 0.3rem 0.4rem;
  font-size: 0.88rem;
  text-overflow: ellipsis;
}

/* Neutral Stat Cards Grid (No Color Coding) */
.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 0.75rem;
}

.stat-cards-grid.stat-cards-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-box {
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.55rem 0.4rem;
  text-align: center;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-box .stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  padding-bottom: 0.25rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid #e2e8f0;
  line-height: 1.2;
}

.stat-box .stat-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1.15;
}

.stat-box .stat-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  white-space: nowrap;
}

/* Compact Personal Records Table */
.ranking-table {
  width: 100%;
  max-width: 560px;
  margin: 0.75rem auto 0;
  border-collapse: collapse;
  text-align: center;
  font-size: clamp(0.72rem, 2.5vw, 0.86rem);
}

.ranking-table th {
  background-color: var(--primary-color);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.32rem 0.2rem;
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.ranking-table td {
  padding: 0.35rem 0.25rem;
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.ranking-table th.col-no,
.ranking-table td.col-no {
  width: 38px;
}

.ranking-table th.col-stat,
.ranking-table td.col-stat {
  width: 48px;
}

.ranking-th {
  user-select: none;
  transition: background-color 0.15s ease;
  position: relative;
  cursor: pointer;
}

.ranking-th:not(.active-sort) {
  background-color: var(--primary-color);
  color: #ffffff;
}

@media (hover: hover) {
  .ranking-th:not(.active-sort):hover {
    background-color: var(--primary-light);
  }
}

.ranking-th.active-sort {
  background-color: #ff9800 !important;
  color: #ffffff !important;
  font-weight: bold;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}

.ranking-th.active-sort::after {
  content: ' ▼';
  font-size: 0.7em;
}

.ranking-highlight-cell {
  background-color: #fff8e1 !important;
  color: #e65100 !important;
  font-weight: bold !important;
}

.ranking-table tbody tr.player-stat-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

@media (hover: hover) {
  .ranking-table tbody tr.player-stat-row:hover {
    background-color: #f1f5f9;
  }
}

.ranking-table tbody tr.player-stat-row.selected {
  background-color: #e3f2fd !important;
  box-shadow: inset 4px 0 0 var(--primary-color);
  font-weight: 600;
}

.ranking-table tbody tr.player-stat-row.selected td.ranking-highlight-cell {
  background-color: #ffe0b2 !important;
}

/* Match History Action Bar & Horizontal Scroll Table */
.history-action-bar {
  background-color: #e3f2fd;
  border: 1px solid #90caf9;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 0.65rem;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.history-selected-hint {
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--primary-color);
}

.history-action-bar button {
  width: auto;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
}

.history-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-top: 0.5rem;
}

.history-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  text-align: center;
  font-size: clamp(0.72rem, 2.6vw, 0.9rem);
}

.history-table th, .history-table td {
  padding: 0.5rem 0.45rem;
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.history-table tbody tr.history-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

@media (hover: hover) {
  .history-table tbody tr.history-row:hover {
    background-color: #f8f9fa;
  }
}

.history-table tbody tr.history-row.selected {
  background-color: #e3f2fd !important;
  box-shadow: inset 4px 0 0 var(--primary-color);
  font-weight: 600;
}

/* Read-only Score View Mode */
#view-score.readonly-mode input:disabled,
#view-score.readonly-mode select:disabled {
  background-color: #f8f9fa;
  color: var(--text-main);
  opacity: 1;
  -webkit-text-fill-color: var(--text-main);
  border-color: #dee2e6;
  cursor: default;
}

#view-score.readonly-mode .penalty-toggle {
  cursor: default;
  opacity: 0.6;
}

#view-score.readonly-mode .penalty-toggle.active {
  opacity: 1;
  transform: none;
}

/* Ensure no horizontal scroll on body */
body {
  overflow-x: hidden;
}

@media (max-width: 768px) {
  .record-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .stat-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .stat-cards-grid.stat-cards-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .stat-box {
    padding: 0.45rem 0.3rem;
  }
  .stat-box .stat-label {
    font-size: 0.66rem;
  }
  .stat-box .stat-val {
    font-size: 1.2rem;
  }
  .score-teams-grid {
    gap: 8px;
  }
  .score-team-column {
    padding: 0.5rem;
  }
}

@media (max-width: 640px) {
  .score-meta-grid input,
  .score-meta-grid select,
  .record-filter-grid select {
    font-size: 1rem;
    height: 38px;
  }
  .score-teams-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .score-team-column {
    padding: 0.75rem;
  }
  .score-team-header {
    gap: 6px;
    margin-bottom: 0.5rem;
  }
  .score-team-header-top {
    height: 28px;
    min-height: 28px;
  }
  .score-team-header-top h3 {
    font-size: 0.95rem;
  }
  button.btn-compact {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    height: 28px;
  }
  .score-team-header-sub {
    height: 34px;
    min-height: 34px;
  }
  .score-team-header-sub button.btn-compact {
    height: 34px;
    font-size: 0.85rem;
  }
  .score-team-header-sub input {
    height: 34px;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
  }
  .score-totals {
    height: 38px;
    min-height: 38px;
    padding: 0.35rem 0.5rem;
    gap: 6px;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
  }
  .score-total-input {
    width: 46px !important;
    height: 28px !important;
    font-size: 1rem !important;
    padding: 0 0.25rem !important;
  }
  .score-totals-sub {
    font-size: 0.8rem;
  }
  .score-totals-pen {
    font-size: 0.8rem;
  }
  .score-tabs {
    margin-bottom: 0.5rem;
  }
  .score-tab {
    padding: 0.4rem 0.25rem;
    font-size: 0.85rem;
  }
  .score-list {
    gap: 0.4rem;
    margin-bottom: 0.5rem;
  }
  .score-row {
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    padding: 0 0.4rem;
    gap: 5px;
  }
  .score-row-info {
    gap: 5px;
  }
  .score-row-info input[data-field=number] {
    width: 44px;
    height: 30px;
    padding: 0 0.2rem;
    font-size: 1rem;
  }
  .score-row-info input[data-field=name] {
    height: 30px;
    padding: 0 0.35rem;
    font-size: 1rem;
  }
  .score-input-col {
    height: 30px;
    gap: 3px;
  }
  .score-step-btn {
    width: 28px;
    height: 30px;
    font-size: 0.95rem !important;
  }
  .score-input-col input[type=number] {
    width: 38px;
    height: 30px;
    font-size: 1rem;
  }
  .score-penalty-col {
    height: 30px;
    gap: 4px;
  }
  .penalty-toggle {
    width: 30px;
    height: 30px;
    font-size: 0.95rem;
    border-radius: 5px;
  }
  .penalty-badge {
    width: 14px;
    height: 14px;
    font-size: 0.56rem;
    top: -4px;
    right: -4px;
  }
  button.score-row-del-btn {
    width: 24px;
    height: 30px;
    font-size: 1.05rem !important;
  }
  button.btn-add-score-row {
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  .ranking-table th {
    padding: 0.25rem 0.15rem;
    font-size: 0.66rem;
  }
  .ranking-table td {
    padding: 0.28rem 0.15rem;
    font-size: 0.72rem;
  }
  .history-table th, .history-table td {
    padding: 0.45rem 0.4rem;
  }
}

/* ==================================================
   CLOUD WORKSPACE STATUS BADGE & MODAL
   ================================================== */
.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 1.2rem 1rem;
}

button.cloud-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

button.cloud-status-badge.status-local {
  background-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

button.cloud-status-badge.status-editor {
  background-color: #1b5e20;
  color: #e8f5e9;
  border: 1px solid #66bb6a;
}

button.cloud-status-badge.status-viewer {
  background-color: #0277bd;
  color: #e1f5fe;
  border: 1px solid #4fc3f7;
}

button.cloud-status-badge:hover {
  filter: brightness(1.1);
}

.mobile-header button.cloud-status-badge {
  font-size: 0.72rem;
  padding: 0.24rem 0.6rem;
  max-width: 54vw;
  flex-shrink: 0;
}

.viewer-mode-banner {
  background-color: #e1f5fe;
  color: #01579b;
  border: 1px solid #81d4fa;
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.45;
}

button.viewer-disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  filter: grayscale(0.4);
}

.cloud-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 28, 84, 0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.cloud-modal-card {
  background-color: var(--card-bg);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.2s ease;
}

.cloud-modal-header {
  justify-content: space-between;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}

.cloud-modal-header h3 {
  margin: 0;
  color: var(--primary-color);
  font-size: 1.1rem;
}

button.cloud-modal-close {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0 0.35rem;
  width: auto;
}

button.cloud-modal-close:hover {
  background: #f1f3f5;
  color: var(--text-main);
}

.cloud-modal-message {
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.84rem;
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.cloud-modal-message.error {
  background-color: #fff5f5;
  color: #c92a2a;
  border: 1px solid #ffc9c9;
}

.cloud-modal-message.success {
  background-color: #ebfbee;
  color: #2b8a3e;
  border: 1px solid #b2f2bb;
}

.cloud-modal-message.info {
  background-color: #e7f5ff;
  color: #1864ab;
  border: 1px solid #a5d8ff;
}

.cloud-info-box {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cloud-info-row {
  justify-content: space-between;
  gap: 8px;
}

.cloud-info-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.cloud-info-val {
  font-size: 0.98rem;
  color: var(--primary-color);
}

.cloud-info-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cloud-role-pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.cloud-role-pill.role-editor {
  background-color: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #81c784;
}

.cloud-role-pill.role-viewer {
  background-color: #e1f5fe;
  color: #01579b;
  border: 1px solid #4fc3f7;
}

.cloud-connected-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

button.outline-danger {
  background-color: #ffffff;
  color: #dc3545;
  border: 1px solid #dc3545;
}

button.outline-danger:hover {
  background-color: #fff5f5;
}

.cloud-auth-tabs {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
  background-color: #f8f9fa;
}

button.cloud-auth-tab {
  flex: 1;
  min-width: 0;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 0;
  padding: 0.55rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
}

button.cloud-auth-tab.active {
  background-color: var(--primary-color);
  color: #ffffff;
}

.cloud-help-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  line-height: 1.45;
}

