/* ============================================
   macOS Apps CSS - All Application Styles
   ============================================ */

/* ============ FINDER APP ============ */
.finder-layout {
  display: flex;
  height: 100%;
}

.finder-sidebar {
  width: 180px;
  min-width: 180px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--separator-color);
  padding: 8px 0;
  overflow-y: auto;
  flex-shrink: 0;
}

.finder-sidebar-section {
  margin-bottom: 8px;
}

.finder-sidebar-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 16px 4px;
}

.finder-sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px;
  font-size: 12.5px;
  cursor: default;
  border-radius: 6px;
  margin: 0 6px;
  transition: background 0.1s ease;
  color: var(--text-primary);
}

.finder-sidebar-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

body.dark-mode .finder-sidebar-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.finder-sidebar-item.active {
  background: var(--selection-color);
  color: var(--accent-color);
}

.finder-sidebar-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.finder-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.finder-files {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 20px;
  overflow-y: auto;
}

.finder-file {
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: default;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.1s ease;
}

.finder-file:hover {
  background: rgba(0, 0, 0, 0.04);
}

.finder-file.selected {
  background: var(--selection-color);
}

.finder-file-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.finder-file-icon svg {
  width: 100%;
  height: 100%;
}

.finder-file-name {
  font-size: 11px;
  text-align: center;
  line-height: 1.3;
  max-width: 80px;
  overflow: hidden;
  word-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.finder-file.selected .finder-file-name {
  background: var(--accent-color);
  color: white;
  border-radius: 3px;
  padding: 1px 4px;
}

/* Finder status bar */
.finder-statusbar {
  padding: 4px 12px;
  font-size: 11px;
  color: var(--text-secondary);
  border-top: 1px solid var(--separator-color);
  background: var(--bg-toolbar);
  flex-shrink: 0;
}

/* ============ CALCULATOR APP ============ */
.calculator-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #1c1c1e;
  user-select: none;
}

.calc-display {
  padding: 12px 20px;
  text-align: right;
  flex-shrink: 0;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.calc-expression {
  font-size: 16px;
  color: #8e8e93;
  min-height: 20px;
  font-weight: 300;
}

.calc-result {
  font-size: 48px;
  color: white;
  font-weight: 300;
  letter-spacing: -1px;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1.1;
}

.calc-result.small-text {
  font-size: 36px;
}

.calc-result.smaller-text {
  font-size: 28px;
}

.calc-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  padding: 1px;
  flex: 1;
}

.calc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.1s ease;
  color: white;
  position: relative;
  font-family: var(--system-font);
  border-radius: 0;
}

.calc-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.calc-btn:active::after {
  opacity: 0.15;
}

.calc-btn-number {
  background: #333336;
}

.calc-btn-operator {
  background: #ff9f0a;
  color: white;
  font-size: 26px;
}

.calc-btn-operator.active {
  background: white;
  color: #ff9f0a;
}

.calc-btn-function {
  background: #636366;
  font-size: 18px;
}

.calc-btn-zero {
  grid-column: span 2;
  justify-content: flex-start;
  padding-left: 28px;
}

/* ============ NOTES APP ============ */
.notes-layout {
  display: flex;
  height: 100%;
}

.notes-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--separator-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.notes-sidebar-header {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--separator-color);
}

.notes-sidebar-header h3 {
  font-size: 13px;
  font-weight: 600;
}

.notes-new-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  color: var(--accent-color);
  font-size: 18px;
  transition: background 0.1s;
}

.notes-new-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}

.notes-list-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: default;
  margin-bottom: 2px;
  transition: background 0.1s;
}

.notes-list-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.notes-list-item.active {
  background: var(--accent-color);
  color: white;
}

.notes-list-item-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.notes-list-item-preview {
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.notes-list-item.active .notes-list-item-preview {
  color: rgba(255, 255, 255, 0.7);
}

.notes-list-item-date {
  font-size: 10px;
  color: var(--text-tertiary);
}

.notes-list-item.active .notes-list-item-date {
  color: rgba(255, 255, 255, 0.5);
}

.notes-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.notes-editor-toolbar {
  padding: 8px 14px;
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--separator-color);
}

.notes-toolbar-btn {
  width: 28px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.1s;
  font-size: 14px;
  font-weight: 600;
}

.notes-toolbar-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.notes-toolbar-btn.active {
  background: var(--accent-color);
  color: white;
}

.notes-content {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
}

.notes-content [contenteditable] {
  outline: none;
  min-height: 100%;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  font-family: var(--system-font);
}

.notes-content [contenteditable] h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* ============ TERMINAL APP ============ */
.terminal-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: rgba(30, 30, 30, 0.95);
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
}

.terminal-output {
  flex: 1;
  padding: 10px 14px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
  color: #e5e5ea;
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-line {
  margin-bottom: 2px;
}

.terminal-prompt {
  color: #34c759;
}

.terminal-command {
  color: #e5e5ea;
}

.terminal-output-text {
  color: #c7c7cc;
}

.terminal-error {
  color: #ff453a;
}

.terminal-info {
  color: #5ac8fa;
}

.terminal-input-line {
  display: flex;
  align-items: center;
  padding: 0 14px 10px;
  gap: 0;
  flex-shrink: 0;
}

.terminal-input-prompt {
  color: #34c759;
  font-size: 13px;
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
  white-space: pre;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e5e5ea;
  font-size: 13px;
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
  caret-color: #34c759;
}

/* ============ SAFARI APP ============ */
.safari-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: white;
}

body.dark-mode .safari-layout {
  background: #1c1c1e;
}

.safari-toolbar {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 8px;
  background: var(--bg-toolbar);
  border-bottom: 1px solid var(--separator-color);
  flex-shrink: 0;
}

.safari-nav-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.1s;
}

.safari-nav-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.safari-nav-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}

.safari-url-bar {
  flex: 1;
  height: 30px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 6px;
  transition: all 0.2s ease;
}

body.dark-mode .safari-url-bar {
  background: rgba(255, 255, 255, 0.06);
}

.safari-url-bar:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
  background: white;
}

body.dark-mode .safari-url-bar:focus-within {
  background: #2c2c2e;
}

.safari-url-bar svg {
  width: 12px;
  height: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.safari-url-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  font-family: var(--system-font);
  text-align: center;
}

.safari-url-input::placeholder {
  color: var(--text-tertiary);
}

.safari-tabs {
  display: flex;
  background: var(--bg-toolbar);
  border-bottom: 1px solid var(--separator-color);
  overflow-x: auto;
  flex-shrink: 0;
}

.safari-tab {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  font-size: 12px;
  cursor: default;
  border-right: 1px solid var(--separator-color);
  min-width: 120px;
  max-width: 200px;
  gap: 6px;
  transition: background 0.1s;
  color: var(--text-secondary);
}

.safari-tab.active {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.safari-tab:hover {
  background: rgba(0, 0, 0, 0.03);
}

.safari-tab-close {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  opacity: 0;
  transition: all 0.1s;
  flex-shrink: 0;
}

.safari-tab:hover .safari-tab-close {
  opacity: 0.5;
}

.safari-tab-close:hover {
  opacity: 1 !important;
  background: rgba(0, 0, 0, 0.1);
}

.safari-tab-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.safari-content {
  flex: 1;
  overflow: auto;
}

.safari-start-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  gap: 30px;
}

.safari-favorites-grid {
  display: grid;
  grid-template-columns: repeat(4, 80px);
  gap: 20px;
  justify-content: center;
}

.safari-favorite {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s;
}

.safari-favorite:hover {
  transform: scale(1.05);
}

.safari-favorite-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.safari-favorite-name {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}

.safari-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ============ CALENDAR APP ============ */
.calendar-layout {
  display: flex;
  height: 100%;
}

.calendar-sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--separator-color);
  padding: 12px;
  flex-shrink: 0;
}

.calendar-mini {
  margin-bottom: 20px;
}

.calendar-mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.calendar-mini-header h4 {
  font-size: 13px;
  font-weight: 600;
}

.calendar-mini-nav {
  display: flex;
  gap: 4px;
}

.calendar-mini-nav button {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--accent-color);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.calendar-mini-nav button:hover {
  background: rgba(0, 0, 0, 0.06);
}

.calendar-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.calendar-mini-day-header {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 600;
  padding: 4px 0;
}

.calendar-mini-day {
  font-size: 11px;
  padding: 4px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.1s;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-mini-day:hover {
  background: rgba(0, 0, 0, 0.06);
}

.calendar-mini-day.today {
  background: var(--accent-color);
  color: white;
  font-weight: 600;
}

.calendar-mini-day.other-month {
  color: var(--text-tertiary);
}

.calendar-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calendar-main-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--separator-color);
}

.calendar-main-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.calendar-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  overflow: hidden;
}

.calendar-day-header {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  padding: 8px;
  font-weight: 600;
  border-bottom: 1px solid var(--separator-color);
}

.calendar-day-cell {
  border-right: 1px solid var(--separator-color);
  border-bottom: 1px solid var(--separator-color);
  padding: 6px;
  min-height: 80px;
  cursor: default;
  transition: background 0.1s;
}

.calendar-day-cell:hover {
  background: rgba(0, 0, 0, 0.02);
}

.calendar-day-number {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
}

.calendar-day-cell.today .calendar-day-number {
  width: 22px;
  height: 22px;
  background: var(--accent-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-day-cell.other-month {
  opacity: 0.3;
}

.calendar-event {
  font-size: 10px;
  padding: 2px 4px;
  background: var(--accent-color);
  color: white;
  border-radius: 3px;
  margin-bottom: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ============ TEXTEDIT APP ============ */
.textedit-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.textedit-toolbar {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 6px;
  border-bottom: 1px solid var(--separator-color);
  background: var(--bg-toolbar);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.textedit-toolbar select {
  height: 24px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--system-font);
  padding: 0 6px;
  outline: none;
  cursor: pointer;
}

.textedit-toolbar button {
  height: 26px;
  min-width: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--system-font);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}

.textedit-toolbar button:hover {
  background: rgba(0, 0, 0, 0.06);
}

.textedit-toolbar button.active {
  background: var(--accent-color);
  color: white;
}

.textedit-content {
  flex: 1;
  padding: 20px 30px;
  overflow-y: auto;
}

.textedit-content [contenteditable] {
  outline: none;
  min-height: 100%;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  font-family: var(--system-font);
}

/* ============ SYSTEM PREFERENCES APP ============ */
.syspref-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.syspref-header {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid var(--separator-color);
  background: var(--bg-toolbar);
}

.syspref-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.syspref-search {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.syspref-search input {
  width: 260px;
  height: 28px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0 10px 0 28px;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  background: var(--bg-primary);
  font-family: var(--system-font);
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}

.syspref-search input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.syspref-grid {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, 90px);
  gap: 20px;
  justify-content: center;
  align-content: start;
}

.syspref-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.1s;
}

.syspref-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

body.dark-mode .syspref-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.syspref-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.syspref-item-name {
  font-size: 11px;
  text-align: center;
  line-height: 1.2;
}

/* System Preferences Panels */
.syspref-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.syspref-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--separator-color);
}

.syspref-back-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  color: var(--accent-color);
  transition: background 0.1s;
  font-size: 18px;
}

.syspref-back-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.syspref-panel-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.syspref-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--separator-color);
}

.syspref-setting:last-child {
  border-bottom: none;
}

.syspref-setting-label {
  font-size: 13px;
  font-weight: 500;
}

.syspref-setting-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Toggle Switch */
.toggle-switch {
  width: 40px;
  height: 24px;
  background: #e5e5ea;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s ease;
}

body.dark-mode .toggle-switch {
  background: #39393d;
}

.toggle-switch.active {
  background: var(--accent-color);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active::after {
  transform: translateX(16px);
}

/* Keyboard Panel */
.keyboard-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 20px 0;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.keyboard-row {
  display: flex;
  gap: 4px;
}

.keyboard-key {
  min-width: 36px;
  height: 32px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  cursor: default;
  transition: all 0.1s;
  padding: 0 6px;
}

.keyboard-key:active {
  transform: translateY(1px);
  box-shadow: none;
  background: var(--bg-tertiary);
}

.keyboard-key.wide { min-width: 52px; }
.keyboard-key.wider { min-width: 70px; }
.keyboard-key.widest { min-width: 90px; }
.keyboard-key.space { min-width: 200px; }
.keyboard-key.special { background: var(--bg-tertiary); }
.keyboard-key.highlight {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

/* ============ MESSAGES APP ============ */
.messages-layout {
  display: flex;
  height: 100%;
}

.messages-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--separator-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.messages-sidebar-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--separator-color);
}

.messages-search {
  width: 100%;
  height: 28px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0 10px;
  font-size: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  font-family: var(--system-font);
}

.messages-search:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.messages-list {
  flex: 1;
  overflow-y: auto;
}

.messages-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: default;
  transition: background 0.1s;
}

.messages-contact:hover {
  background: rgba(0, 0, 0, 0.04);
}

.messages-contact.active {
  background: var(--accent-color);
  color: white;
}

.messages-contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5ac8fa, #007aff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.messages-contact-info {
  flex: 1;
  overflow: hidden;
}

.messages-contact-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.messages-contact-preview {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.messages-contact.active .messages-contact-preview {
  color: rgba(255, 255, 255, 0.7);
}

.messages-contact-time {
  font-size: 10px;
  color: var(--text-tertiary);
  align-self: flex-start;
  margin-top: 2px;
}

.messages-contact.active .messages-contact-time {
  color: rgba(255, 255, 255, 0.5);
}

.messages-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.messages-chat-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--separator-color);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.messages-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-bubble {
  max-width: 70%;
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.message-sent {
  align-self: flex-end;
  background: var(--accent-color);
  color: white;
  border-bottom-right-radius: 6px;
}

.message-received {
  align-self: flex-start;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
}

.messages-input-area {
  padding: 10px 16px;
  border-top: 1px solid var(--separator-color);
  display: flex;
  gap: 8px;
}

.messages-input {
  flex: 1;
  height: 34px;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 0 14px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-primary);
  outline: none;
  font-family: var(--system-font);
}

.messages-input:focus {
  border-color: var(--accent-color);
}

.messages-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-color);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.messages-send-btn:hover {
  background: var(--accent-hover);
}

.messages-send-btn:active {
  transform: scale(0.92);
}

/* ============ PHOTOS APP ============ */
.photos-layout {
  display: flex;
  height: 100%;
}

.photos-sidebar {
  width: 180px;
  min-width: 180px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--separator-color);
  padding: 8px 0;
  flex-shrink: 0;
}

.photos-sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 12.5px;
  cursor: default;
  border-radius: 6px;
  margin: 0 6px;
  transition: background 0.1s;
}

.photos-sidebar-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.photos-sidebar-item.active {
  background: var(--selection-color);
  color: var(--accent-color);
}

.photos-grid {
  flex: 1;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 4px;
  overflow-y: auto;
  align-content: start;
}

.photos-item {
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
  position: relative;
}

.photos-item:hover {
  transform: scale(1.03);
  z-index: 1;
}

.photos-item-color {
  width: 100%;
  height: 100%;
}
