:root {
    --background-color: #1a1a1a;
    --text-color: #ffffff;
    --accent-color: #007aff;
    --secondary-accent: #ff2d55;
    --input-bg: #2a2a2a;
    --input-border: #3a3a3a;
    --button-bg: #007aff;
    --button-hover: #005bb5;
    --secondary-text: #b0b0b0;
  }
  
  body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Inter', Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
  }
  
  .container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 20px; /* Consistent spacing between elements */
  }
  
  #active-service {
    text-align: center;
    padding: 20px;
    background: var(--input-bg);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0; /* Prevents shrinking too much */
  }

  .active-icon {
    width: 32px; /* Match grid size */
    height: 32px; /* Match grid size */
    border-radius: 8px;
    margin: 0 auto 10px;
  }

  #totp-code {
    font-size: 28px; /* Increased from default */
    margin: 10px 0;
    font-weight: 500;
  }
  
  #copy-btn {
    min-width: 120px; /* Fixed width to prevent jumping */
    padding: 10px 20px;
  }
  
  #services-container {
    flex-grow: 1;
    overflow-y: auto;
    border-radius: 12px;
  }
  
  .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 20px;
  }
  
  .service {
    text-align: center;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.2s;
  }
  
  .service:hover {
    background: var(--input-bg);
  }
  
  .service img {
    width: 32px; /* Reduced from 64px */
    height: 32px; /* Reduced from 64px */
    border-radius: 8px;
  }
  
  .service p {
    margin: 5px 0 0;
    font-size: 14px;
    color: var(--secondary-text);
  }
  
  .code-display h2 {
    margin: 10px 0;
    font-weight: 600;
  }
  
  .timer {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 10px auto;
  }
  
  .timer svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* Start at 12 o'clock */
  }
  
  .timer-bg {
    fill: none;
    stroke: var(--input-border);
    stroke-width: 5;
  }
  
  .timer-progress {
    fill: none;
    stroke: var(--accent-color);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 283; /* Circumference of r=45 circle */
    stroke-dashoffset: 283; /* Starts fully hidden */
    transition: stroke-dashoffset 1s linear;
  }
  
  .timer span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: var(--text-color);
  }
  
  @keyframes countdown {
    0% { background: conic-gradient(var(--accent-color) 0% 100%, transparent 0% 100%); }
    100% { background: conic-gradient(var(--accent-color) 0% 0%, transparent 0% 100%); }
  }
  
  button {
    background: var(--button-bg);
    color: var(--button-text);
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
  }
  
  button:hover {
    background: var(--button-hover);
  }
  
  #edit-delete {
    background: var(--secondary-accent);
  }
  
  #edit-delete:hover {
    background: #cc2444;
  }
  
  .icon-btn {
    position: absolute;
    top: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 36px;
    background: var(--input-bg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  }
  
  #add-btn {
    right: 70px;
  }
  
  #edit-btn {
    right: 20px;
  }
  
  #edit-close {
    right: 20px;
  }
  
  .modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .modal-content {
    background: var(--background-color);
    padding: 20px;
    border-radius: 12px;
    width: 320px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  
  .modal-content h2 {
    font-weight: 600;
    margin-bottom: 20px;
  }
  
  .modal-content input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
  }
  
  #edit-list div {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--input-border);
  }
  
  #edit-list div:hover {
    background: var(--input-bg);
  }

  #search-bar {
    width: 100%;
    max-width: 400px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    align-self: center; /* Centers horizontally in flex container */
  }
  
  #search-bar::placeholder {
    color: var(--secondary-text);
  }

  .header {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
  }
  
  #add-account {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 14px;
    padding: 10px;
  }
  
  #add-account:hover {
    text-decoration: underline;
  }